diff options
author | Vincent Scheib <scheib@chromium.org> | 2015-03-27 17:19:32 -0700 |
---|---|---|
committer | Vincent Scheib <scheib@chromium.org> | 2015-03-28 00:20:59 +0000 |
commit | 49fdb401fce873c6390f2df5bce2deac2921ee93 (patch) | |
tree | 83534d9b229959d9b0af0f159825d6e6b7b8ad7d | |
parent | 1d139b208626492b3bcdd50a43902d6c91481d27 (diff) | |
download | chromium_src-49fdb401fce873c6390f2df5bce2deac2921ee93.zip chromium_src-49fdb401fce873c6390f2df5bce2deac2921ee93.tar.gz chromium_src-49fdb401fce873c6390f2df5bce2deac2921ee93.tar.bz2 |
Revert "Enable chrome.automation.getDesktop on all aura platforms."
This reverts commit 35b188a996e59c65787207818c7b90d70007f03d.
Caused browser_tests AutomationApiTest.DesktopLoadTabs to fail
e.g.:
https://build.chromium.org/p/chromium.linux/builders/Linux%20Tests/builds/22541
"""
AutomationApiTest.DesktopLoadTabs (run #1):
[ RUN ] AutomationApiTest.DesktopLoadTabs
Xlib: extension "RANDR" missing on display ":9".
Xlib: extension "RANDR" missing on display ":9".
[25828:25828:0327/163831:INFO:audio_manager_pulse.cc(258)] Failed to connect to the context. Error: Connection refused
[25828:25932:0327/163832:WARNING:data_reduction_proxy_config.cc(330)] SPDY proxy OFF at startup
[25828:25828:0327/163832:WARNING:password_store_factory.cc(259)] Using basic (unencrypted) store for password storage. See http://code.google.com/p/chromium/wiki/LinuxPasswordStorage for more information about password storage options.
[25828:25828:0327/163832:INFO:CONSOLE(0)] "calling getTree() callback", source: chrome-extension://mojndmjfhfgjjicpoiodenhflfmkopil/load_tabs.html (0)
[25828:25828:0327/163832:INFO:CONSOLE(0)] "calling getTree() callback", source: chrome-extension://mojndmjfhfgjjicpoiodenhflfmkopil/load_tabs.html (0)
[25828:25828:0327/163832:INFO:CONSOLE(0)] "[FAIL] testLoadTabs: uncaught exception: Cannot read property 'firstChild' of undefined: TypeError: Cannot read property 'firstChild' of undefined
at testLoadTabs (chrome-extension://mojndmjfhfgjjicpoiodenhflfmkopil/load_tabs.js:28:36)
"""
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=Original Patch Had No Bug!?!
TBR=dmazzoni@chromium.org, oshima@chromium.org, sky@chromium.org, dtseng@chromium.org
Review URL: https://codereview.chromium.org/1040863002
Cr-Commit-Position: refs/heads/master@{#322684}
25 files changed, 229 insertions, 230 deletions
diff --git a/chrome/browser/chromeos/input_method/accessibility.cc b/chrome/browser/chromeos/input_method/accessibility.cc index 59ef865..886f4ff 100644 --- a/chrome/browser/chromeos/input_method/accessibility.cc +++ b/chrome/browser/chromeos/input_method/accessibility.cc @@ -8,7 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" +#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" namespace chromeos { namespace input_method { @@ -36,7 +36,7 @@ void Accessibility::InputMethodChanged(InputMethodManager* imm, const std::string medium_name = base::UTF16ToUTF8( imm_->GetInputMethodUtil()->GetInputMethodMediumName(descriptor)); - AutomationManagerAura::GetInstance()->HandleAlert( + AutomationManagerAsh::GetInstance()->HandleAlert( ProfileManager::GetActiveUserProfile(), medium_name); } diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 9fdb88a..db71d44 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -43,7 +43,7 @@ #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/system/device_disabling_manager.h" #include "chrome/browser/signin/easy_unlock_service.h" -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" +#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" @@ -991,7 +991,7 @@ void ExistingUserController::ShowGaiaPasswordChanged( void ExistingUserController::SendAccessibilityAlert( const std::string& alert_text) { - AutomationManagerAura::GetInstance()->HandleAlert( + AutomationManagerAsh::GetInstance()->HandleAlert( ProfileHelper::GetSigninProfile(), alert_text); } diff --git a/chrome/browser/extensions/api/automation/automation_apitest.cc b/chrome/browser/extensions/api/automation/automation_apitest.cc index 381a749..b5e2dd3 100644 --- a/chrome/browser/extensions/api/automation/automation_apitest.cc +++ b/chrome/browser/extensions/api/automation/automation_apitest.cc @@ -27,12 +27,6 @@ #include "ui/accessibility/ax_tree_serializer.h" #include "ui/accessibility/tree_generator.h" -#if defined(OS_CHROMEOS) -#include "ash/accelerators/accelerator_controller.h" -#include "ash/shell.h" -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" -#endif - namespace extensions { namespace { @@ -146,7 +140,7 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, TabsAutomationHostsPermissions) { << message_; } -#if defined(USE_AURA) +#if defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(AutomationApiTest, Desktop) { ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "desktop.html")) << message_; @@ -157,18 +151,12 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotRequested) { "desktop_not_requested.html")) << message_; } -#if defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopActions) { - AutomationManagerAura::GetInstance()->Enable(browser()->profile()); - // Trigger the shelf subtree to be computed. - ash::Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled( - ash::FOCUS_SHELF); - ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "actions.html")) << message_; } -#endif // defined(OS_CHROMEOS) +// http://crbug.com/435449 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) { ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "load_tabs.html")) << message_; @@ -176,8 +164,7 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) { #else IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotSupported) { ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", - "desktop_not_supported.html")) - << message_; + "desktop_not_supported.html")) << message_; } #endif diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc index f4d2092..296ce46 100644 --- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc +++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc @@ -30,8 +30,8 @@ #include "extensions/common/extension_messages.h" #include "extensions/common/permissions/permissions_data.h" -#if defined(USE_AURA) -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" #endif namespace extensions { @@ -257,6 +257,7 @@ AutomationInternalEnableTabFunction::Run() { ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() { // TODO(dtseng): Limited to desktop tree for now pending out of proc iframes. +#if defined(OS_CHROMEOS) using api::automation_internal::EnableFrame::Params; scoped_ptr<Params> params(Params::Create(*args_)); @@ -274,6 +275,8 @@ ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() { contents->EnableTreeOnlyAccessibilityMode(); return RespondNow(NoArguments()); +#endif + return RespondNow(Error("enableFrame is only supported on Chrome OS")); } ExtensionFunction::ResponseAction @@ -286,14 +289,14 @@ AutomationInternalPerformActionFunction::Run() { EXTENSION_FUNCTION_VALIDATE(params.get()); if (params->args.tree_id == kDesktopTreeID) { -#if defined(USE_AURA) - return RouteActionToAdapter(params.get(), - AutomationManagerAura::GetInstance()); +#if defined(OS_CHROMEOS) + return RouteActionToAdapter( + params.get(), AutomationManagerAsh::GetInstance()); #else NOTREACHED(); return RespondNow(Error("Unexpected action on desktop automation tree;" " platform does not support desktop automation")); -#endif // defined(USE_AURA) +#endif // defined(OS_CHROMEOS) } AXTreeIDRegistry::FrameID frame_id = AXTreeIDRegistry::GetInstance()->GetFrameID(params->args.tree_id); @@ -346,16 +349,16 @@ AutomationInternalPerformActionFunction::RouteActionToAdapter( ExtensionFunction::ResponseAction AutomationInternalEnableDesktopFunction::Run() { -#if defined(USE_AURA) +#if defined(OS_CHROMEOS) const AutomationInfo* automation_info = AutomationInfo::Get(extension()); if (!automation_info || !automation_info->desktop) return RespondNow(Error("desktop permission must be requested")); - AutomationManagerAura::GetInstance()->Enable(browser_context()); + AutomationManagerAsh::GetInstance()->Enable(browser_context()); return RespondNow(NoArguments()); #else return RespondNow(Error("getDesktop is unsupported by this platform")); -#endif // defined(USE_AURA) +#endif // defined(OS_CHROMEOS) } // static diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs index 24f6150..0d336cb 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs @@ -69,6 +69,29 @@ SYNC_TEST_F('BackgroundTest', 'NextNamespaces', function() { assertEquals('function', typeof(Background)); }); +/** Tests that ChromeVox reads the desktop tree. */ +TEST_F('BackgroundTest', 'DesktopFocus', function() { + function findStatusTray(root) { + if (root.role == chrome.automation.RoleType.button && + root.attributes.name && + root.attributes.name.indexOf('Status tray') != -1) { + return root; + } + for (var i = 0; i < root.children.length; i++) { + var found = findStatusTray(root.children[i]); + if (found) + return found; + } + return null; + } + + chrome.automation.getDesktop(this.newCallback(function(root) { + var testButton = findStatusTray(root); + cvox.ChromeVox.tts.expectSpeech('Status tray', this.newCallback()); + testButton.focus(); + })); +}); + /** Tests feedback once a page loads. */ TEST_F('BackgroundTest', 'MANUAL_InitialFeedback', function() { cvox.ChromeVox.tts.expectSpeech('start', this.newCallback()); diff --git a/chrome/browser/resources/chromeos/chromevox/manifest.json.jinja2 b/chrome/browser/resources/chromeos/chromevox/manifest.json.jinja2 index 5bfabfe..c7e43e4 100644 --- a/chrome/browser/resources/chromeos/chromevox/manifest.json.jinja2 +++ b/chrome/browser/resources/chromeos/chromevox/manifest.json.jinja2 @@ -10,7 +10,11 @@ "incognito": "split", {% endif %} "background": { +{% if is_chromevox_classic == '1' %} + "page": "chromevox/background/background.html" +{% else %} "page": "cvox2/background/background.html" +{% endif %} }, "permissions": [ "accessibilityPrivate", @@ -52,10 +56,10 @@ "chromevox/injected/mathjax.js", "chromevox/injected/mathjax_external_util.js" ], +{% if is_chromevox_classic == '0' %} "automation": { "desktop": true }, -{% if is_chromevox_classic == '0' %} "commands": { "nextElement": { "description": "__MSG_CHROMEVOX_NEXT_OBJECT__", diff --git a/chrome/browser/resources/chromeos/chromevox/tools/publish_webstore_extension.py b/chrome/browser/resources/chromeos/chromevox/tools/publish_webstore_extension.py index fe8af1e..8ffc771 100755 --- a/chrome/browser/resources/chromeos/chromevox/tools/publish_webstore_extension.py +++ b/chrome/browser/resources/chromeos/chromevox/tools/publish_webstore_extension.py @@ -36,6 +36,7 @@ import version # A list of files (or directories) to exclude from the webstore build. EXCLUDE_PATHS = [ + 'cvox2/background/', 'manifest.json', 'manifest_guest.json', ] diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc b/chrome/browser/ui/ash/accessibility/automation_manager_ash.cc index 8a0bc14..a672e9c 100644 --- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc +++ b/chrome/browser/ui/ash/accessibility/automation_manager_ash.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" +#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" #include <vector> @@ -21,14 +21,14 @@ using content::BrowserContext; // static -AutomationManagerAura* AutomationManagerAura::GetInstance() { - return Singleton<AutomationManagerAura>::get(); +AutomationManagerAsh* AutomationManagerAsh::GetInstance() { + return Singleton<AutomationManagerAsh>::get(); } -void AutomationManagerAura::Enable(BrowserContext* context) { +void AutomationManagerAsh::Enable(BrowserContext* context) { enabled_ = true; if (!current_tree_.get()) - current_tree_.reset(new AXTreeSourceAura()); + current_tree_.reset(new AXTreeSourceAsh()); ResetSerializer(); SendEvent(context, current_tree_->GetRoot(), ui::AX_EVENT_LOAD_COMPLETE); if (!pending_alert_text_.empty()) { @@ -37,16 +37,16 @@ void AutomationManagerAura::Enable(BrowserContext* context) { } } -void AutomationManagerAura::Disable() { +void AutomationManagerAsh::Disable() { enabled_ = false; // Reset the serializer to save memory. current_tree_serializer_->Reset(); } -void AutomationManagerAura::HandleEvent(BrowserContext* context, - views::View* view, - ui::AXEvent event_type) { +void AutomationManagerAsh::HandleEvent(BrowserContext* context, + views::View* view, + ui::AXEvent event_type) { if (!enabled_) return; @@ -60,24 +60,11 @@ void AutomationManagerAura::HandleEvent(BrowserContext* context, views::AXAuraObjWrapper* aura_obj = views::AXAuraObjCache::GetInstance()->GetOrCreate(view); - - if (processing_events_) { - pending_events_.push_back(std::make_pair(aura_obj, event_type)); - return; - } - - processing_events_ = true; SendEvent(context, aura_obj, event_type); - - for (size_t i = 0; i < pending_events_.size(); ++i) - SendEvent(context, pending_events_[i].first, pending_events_[i].second); - - processing_events_ = false; - pending_events_.clear(); } -void AutomationManagerAura::HandleAlert(content::BrowserContext* context, - const std::string& text) { +void AutomationManagerAsh::HandleAlert(content::BrowserContext* context, + const std::string& text) { if (!enabled_) { pending_alert_text_ = text; return; @@ -89,51 +76,52 @@ void AutomationManagerAura::HandleAlert(content::BrowserContext* context, SendEvent(context, obj, ui::AX_EVENT_ALERT); } -void AutomationManagerAura::DoDefault(int32 id) { +void AutomationManagerAsh::DoDefault(int32 id) { CHECK(enabled_); current_tree_->DoDefault(id); } -void AutomationManagerAura::Focus(int32 id) { +void AutomationManagerAsh::Focus(int32 id) { CHECK(enabled_); current_tree_->Focus(id); } -void AutomationManagerAura::MakeVisible(int32 id) { +void AutomationManagerAsh::MakeVisible(int32 id) { CHECK(enabled_); current_tree_->MakeVisible(id); } -void AutomationManagerAura::SetSelection(int32 id, int32 start, int32 end) { +void AutomationManagerAsh::SetSelection(int32 id, int32 start, int32 end) { CHECK(enabled_); current_tree_->SetSelection(id, start, end); } -AutomationManagerAura::AutomationManagerAura() - : enabled_(false), processing_events_(false) { +AutomationManagerAsh::AutomationManagerAsh() : enabled_(false) { } -AutomationManagerAura::~AutomationManagerAura() { -} +AutomationManagerAsh::~AutomationManagerAsh() {} -void AutomationManagerAura::ResetSerializer() { +void AutomationManagerAsh::ResetSerializer() { current_tree_serializer_.reset( - new ui::AXTreeSerializer<views::AXAuraObjWrapper*>(current_tree_.get())); + new ui::AXTreeSerializer<views::AXAuraObjWrapper*>( + current_tree_.get())); } -void AutomationManagerAura::SendEvent(BrowserContext* context, - views::AXAuraObjWrapper* aura_obj, - ui::AXEvent event_type) { +void AutomationManagerAsh::SendEvent(BrowserContext* context, + views::AXAuraObjWrapper* aura_obj, + ui::AXEvent event_type) { ui::AXTreeUpdate update; current_tree_serializer_->SerializeChanges(aura_obj, &update); // Route this event to special process/routing ids recognized by the // Automation API as the desktop tree. // TODO(dtseng): Would idealy define these special desktop constants in idl. - content::AXEventNotificationDetails detail( - update.node_id_to_clear, update.nodes, event_type, aura_obj->GetID(), - 0, /* process_id */ - 0 /* routing_id */); + content::AXEventNotificationDetails detail(update.node_id_to_clear, + update.nodes, + event_type, + aura_obj->GetID(), + 0, /* process_id */ + 0 /* routing_id */); std::vector<content::AXEventNotificationDetails> details; details.push_back(detail); extensions::automation_util::DispatchAccessibilityEventsToAutomation( diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura.h b/chrome/browser/ui/ash/accessibility/automation_manager_ash.h index 1483e14..30fe46d 100644 --- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.h +++ b/chrome/browser/ui/ash/accessibility/automation_manager_ash.h @@ -2,17 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ -#define CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ +#ifndef CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_ASH_H_ +#define CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_ASH_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/api/automation_internal/automation_action_adapter.h" -#include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" +#include "chrome/browser/ui/ash/accessibility/ax_tree_source_ash.h" #include "ui/accessibility/ax_tree_serializer.h" -template <typename T> -struct DefaultSingletonTraits; +template <typename T> struct DefaultSingletonTraits; namespace content { class BrowserContext; @@ -24,10 +23,10 @@ class View; } // namespace views // Manages a tree of automation nodes. -class AutomationManagerAura : public extensions::AutomationActionAdapter { +class AutomationManagerAsh : public extensions::AutomationActionAdapter { public: // Get the single instance of this class. - static AutomationManagerAura* GetInstance(); + static AutomationManagerAsh* GetInstance(); // Enable automation support for views. void Enable(content::BrowserContext* context); @@ -49,14 +48,14 @@ class AutomationManagerAura : public extensions::AutomationActionAdapter { void SetSelection(int32 id, int32 start, int32 end) override; protected: - virtual ~AutomationManagerAura(); + virtual ~AutomationManagerAsh(); private: - friend struct DefaultSingletonTraits<AutomationManagerAura>; + friend struct DefaultSingletonTraits<AutomationManagerAsh>; - AutomationManagerAura(); + AutomationManagerAsh(); - // Reset all state in this manager. + // Reset all state in this manager. void ResetSerializer(); void SendEvent(content::BrowserContext* context, @@ -69,19 +68,16 @@ class AutomationManagerAura : public extensions::AutomationActionAdapter { // Holds the active views-based accessibility tree. A tree currently consists // of all views descendant to a |Widget| (see |AXTreeSourceViews|). // A tree becomes active when an event is fired on a descendant view. - scoped_ptr<AXTreeSourceAura> current_tree_; + scoped_ptr <AXTreeSourceAsh> current_tree_; // Serializes incremental updates on the currently active tree // |current_tree_|. - scoped_ptr<ui::AXTreeSerializer<views::AXAuraObjWrapper*>> + scoped_ptr<ui::AXTreeSerializer<views::AXAuraObjWrapper*> > current_tree_serializer_; std::string pending_alert_text_; - bool processing_events_; - - std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_; - DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura); + DISALLOW_COPY_AND_ASSIGN(AutomationManagerAsh); }; -#endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ +#endif // CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_ASH_H_ diff --git a/chrome/browser/ui/aura/accessibility/ax_root_obj_wrapper.cc b/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.cc index b565bde..366955d 100644 --- a/chrome/browser/ui/aura/accessibility/ax_root_obj_wrapper.cc +++ b/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.cc @@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/aura/accessibility/ax_root_obj_wrapper.h" +#include "chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.h" +#include "ash/shell.h" #include "base/strings/utf_string_conversions.h" #include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_view_state.h" @@ -44,7 +45,19 @@ views::AXAuraObjWrapper* AXRootObjWrapper::GetParent() { void AXRootObjWrapper::GetChildren( std::vector<views::AXAuraObjWrapper*>* out_children) { - views::AXAuraObjCache::GetInstance()->GetTopLevelWindows(out_children); + if (!ash::Shell::HasInstance()) + return; + + // Only on ash is there a notion of a root with children. + aura::Window::Windows children = + ash::Shell::GetInstance()->GetAllRootWindows(); + for (size_t i = 0; i < children.size(); ++i) { + out_children->push_back( + views::AXAuraObjCache::GetInstance()->GetOrCreate(children[i])); + } + + out_children->push_back( + views::AXAuraObjCache::GetInstance()->GetOrCreate(alert_window_)); } void AXRootObjWrapper::Serialize(ui::AXNodeData* out_node_data) { diff --git a/chrome/browser/ui/aura/accessibility/ax_root_obj_wrapper.h b/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.h index 57f85df..017c0ba 100644 --- a/chrome/browser/ui/aura/accessibility/ax_root_obj_wrapper.h +++ b/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AX_ROOT_OBJ_WRAPPER_H_ -#define CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AX_ROOT_OBJ_WRAPPER_H_ +#ifndef CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_ROOT_OBJ_WRAPPER_H_ +#define CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_ROOT_OBJ_WRAPPER_H_ #include <string> @@ -40,4 +40,4 @@ class AXRootObjWrapper : public views::AXAuraObjWrapper { DISALLOW_COPY_AND_ASSIGN(AXRootObjWrapper); }; -#endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AX_ROOT_OBJ_WRAPPER_H_ +#endif // CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_ROOT_OBJ_WRAPPER_H_ diff --git a/chrome/browser/ui/aura/accessibility/ax_tree_source_aura.cc b/chrome/browser/ui/ash/accessibility/ax_tree_source_ash.cc index 29912c7..c0a6c1a 100644 --- a/chrome/browser/ui/aura/accessibility/ax_tree_source_aura.cc +++ b/chrome/browser/ui/ash/accessibility/ax_tree_source_ash.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" +#include "chrome/browser/ui/ash/accessibility/ax_tree_source_ash.h" #include <vector> #include "chrome/browser/accessibility/ax_tree_id_registry.h" -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" +#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" @@ -19,83 +19,83 @@ using views::AXAuraObjCache; using views::AXAuraObjWrapper; -AXTreeSourceAura::AXTreeSourceAura() { - root_.reset(new AXRootObjWrapper(AXAuraObjCache::GetInstance()->GetNextID())); +AXTreeSourceAsh::AXTreeSourceAsh() { + root_.reset( + new AXRootObjWrapper(AXAuraObjCache::GetInstance()->GetNextID())); } -AXTreeSourceAura::~AXTreeSourceAura() { +AXTreeSourceAsh::~AXTreeSourceAsh() { root_.reset(); } -void AXTreeSourceAura::DoDefault(int32 id) { +void AXTreeSourceAsh::DoDefault(int32 id) { AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); CHECK(obj); obj->DoDefault(); } -void AXTreeSourceAura::Focus(int32 id) { +void AXTreeSourceAsh::Focus(int32 id) { AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); CHECK(obj); obj->Focus(); } -void AXTreeSourceAura::MakeVisible(int32 id) { +void AXTreeSourceAsh::MakeVisible(int32 id) { AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); CHECK(obj); obj->MakeVisible(); } -void AXTreeSourceAura::SetSelection(int32 id, int32 start, int32 end) { +void AXTreeSourceAsh::SetSelection(int32 id, int32 start, int32 end) { AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); CHECK(obj); obj->SetSelection(start, end); } -AXAuraObjWrapper* AXTreeSourceAura::GetRoot() const { +AXAuraObjWrapper* AXTreeSourceAsh::GetRoot() const { return root_.get(); } -AXAuraObjWrapper* AXTreeSourceAura::GetFromId(int32 id) const { +AXAuraObjWrapper* AXTreeSourceAsh::GetFromId(int32 id) const { if (id == root_->GetID()) return root_.get(); return AXAuraObjCache::GetInstance()->Get(id); } -int32 AXTreeSourceAura::GetId(AXAuraObjWrapper* node) const { +int32 AXTreeSourceAsh::GetId(AXAuraObjWrapper* node) const { return node->GetID(); } -void AXTreeSourceAura::GetChildren( - AXAuraObjWrapper* node, +void AXTreeSourceAsh::GetChildren(AXAuraObjWrapper* node, std::vector<AXAuraObjWrapper*>* out_children) const { node->GetChildren(out_children); } -AXAuraObjWrapper* AXTreeSourceAura::GetParent(AXAuraObjWrapper* node) const { +AXAuraObjWrapper* AXTreeSourceAsh::GetParent(AXAuraObjWrapper* node) const { AXAuraObjWrapper* parent = node->GetParent(); if (!parent && node->GetID() != root_->GetID()) parent = root_.get(); return parent; } -bool AXTreeSourceAura::IsValid(AXAuraObjWrapper* node) const { +bool AXTreeSourceAsh::IsValid(AXAuraObjWrapper* node) const { return node && node->GetID() != -1; } -bool AXTreeSourceAura::IsEqual(AXAuraObjWrapper* node1, - AXAuraObjWrapper* node2) const { +bool AXTreeSourceAsh::IsEqual(AXAuraObjWrapper* node1, + AXAuraObjWrapper* node2) const { if (!node1 || !node2) return false; return node1->GetID() == node2->GetID() && node1->GetID() != -1; } -AXAuraObjWrapper* AXTreeSourceAura::GetNull() const { +AXAuraObjWrapper* AXTreeSourceAsh::GetNull() const { return NULL; } -void AXTreeSourceAura::SerializeNode(AXAuraObjWrapper* node, - ui::AXNodeData* out_data) const { +void AXTreeSourceAsh::SerializeNode( + AXAuraObjWrapper* node, ui::AXNodeData* out_data) const { node->Serialize(out_data); if (out_data->role == ui::AX_ROLE_WEB_VIEW) { @@ -113,8 +113,8 @@ void AXTreeSourceAura::SerializeNode(AXAuraObjWrapper* node, } } -std::string AXTreeSourceAura::ToString(AXAuraObjWrapper* root, - std::string prefix) { +std::string AXTreeSourceAsh::ToString( + AXAuraObjWrapper* root, std::string prefix) { ui::AXNodeData data; root->Serialize(&data); std::string output = prefix + data.ToString() + '\n'; diff --git a/chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h b/chrome/browser/ui/ash/accessibility/ax_tree_source_ash.h index f5ac5be..72462eb 100644 --- a/chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h +++ b/chrome/browser/ui/ash/accessibility/ax_tree_source_ash.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AX_TREE_SOURCE_AURA_H_ -#define CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AX_TREE_SOURCE_AURA_H_ +#ifndef CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_TREE_SOURCE_ASH_H_ +#define CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_TREE_SOURCE_ASH_H_ #include <map> #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/ui/aura/accessibility/ax_root_obj_wrapper.h" +#include "chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.h" #include "ui/accessibility/ax_tree_source.h" namespace views { @@ -18,10 +18,11 @@ class AXAuraObjWrapper; // This class exposes the views hierarchy as an accessibility tree permitting // use with other accessibility classes. -class AXTreeSourceAura : public ui::AXTreeSource<views::AXAuraObjWrapper*> { +class AXTreeSourceAsh + : public ui::AXTreeSource<views::AXAuraObjWrapper*> { public: - AXTreeSourceAura(); - ~AXTreeSourceAura() override; + AXTreeSourceAsh(); + ~AXTreeSourceAsh() override; // A set of actions invoked on an Aura view. void DoDefault(int32 id); @@ -51,7 +52,7 @@ class AXTreeSourceAura : public ui::AXTreeSource<views::AXAuraObjWrapper*> { private: scoped_ptr<AXRootObjWrapper> root_; - DISALLOW_COPY_AND_ASSIGN(AXTreeSourceAura); + DISALLOW_COPY_AND_ASSIGN(AXTreeSourceAsh); }; -#endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AX_TREE_SOURCE_AURA_H_ +#endif // CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_TREE_SOURCE_ASH_H_ diff --git a/chrome/browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc b/chrome/browser/ui/ash/accessibility/ax_tree_source_ash_unittest.cc index 2e06aeb..2b42f5c 100644 --- a/chrome/browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc +++ b/chrome/browser/ui/ash/accessibility/ax_tree_source_ash_unittest.cc @@ -6,7 +6,7 @@ #include "ash/test/ash_test_base.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" +#include "chrome/browser/ui/ash/accessibility/ax_tree_source_ash.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/accessibility/ax_enums.h" #include "ui/accessibility/ax_node.h" @@ -39,10 +39,10 @@ size_t GetSize(AXAuraObjWrapper* tree) { return count; } -class AXTreeSourceAuraTest : public ash::test::AshTestBase { +class AXTreeSourceAshTest : public ash::test::AshTestBase { public: - AXTreeSourceAuraTest() {} - ~AXTreeSourceAuraTest() override {} + AXTreeSourceAshTest() {} + ~AXTreeSourceAshTest() override {} void SetUp() override { AshTestBase::SetUp(); @@ -66,11 +66,11 @@ class AXTreeSourceAuraTest : public ash::test::AshTestBase { Textfield* textfield_; private: - DISALLOW_COPY_AND_ASSIGN(AXTreeSourceAuraTest); + DISALLOW_COPY_AND_ASSIGN(AXTreeSourceAshTest); }; -TEST_F(AXTreeSourceAuraTest, Accessors) { - AXTreeSourceAura ax_tree; +TEST_F(AXTreeSourceAshTest, Accessors) { + AXTreeSourceAsh ax_tree; ASSERT_TRUE(ax_tree.GetRoot()); // ID's should start at 1 and there should be a root. @@ -102,45 +102,18 @@ TEST_F(AXTreeSourceAuraTest, Accessors) { ASSERT_EQ(ax_tree.GetRoot(), test_root); } -TEST_F(AXTreeSourceAuraTest, DoDefault) { - AXTreeSourceAura ax_tree; - - // Grab a wrapper to |DoDefault| (click). - AXAuraObjWrapper* textfield_wrapper = - AXAuraObjCache::GetInstance()->GetOrCreate(textfield_); - - // Click and verify focus. - ASSERT_FALSE(textfield_->HasFocus()); - textfield_wrapper->DoDefault(); - ASSERT_TRUE(textfield_->HasFocus()); -} - -TEST_F(AXTreeSourceAuraTest, Focus) { - AXTreeSourceAura ax_tree; - - // Grab a wrapper to focus. - AXAuraObjWrapper* textfield_wrapper = - AXAuraObjCache::GetInstance()->GetOrCreate(textfield_); - - // Focus and verify. - ASSERT_FALSE(textfield_->HasFocus()); - textfield_wrapper->Focus(); - ASSERT_TRUE(textfield_->HasFocus()); -} - -TEST_F(AXTreeSourceAuraTest, Serialize) { - AXTreeSourceAura ax_tree; +TEST_F(AXTreeSourceAshTest, Serialization) { + AXTreeSourceAsh ax_tree; ui::AXTreeSerializer<AXAuraObjWrapper*> ax_serializer(&ax_tree); ui::AXTreeUpdate out_update; // This is the initial serialization. ax_serializer.SerializeChanges(ax_tree.GetRoot(), &out_update); - // The update should just be the desktop node since no events have been fired - // on any controls, so no windows have been cached. - ASSERT_EQ(1U, out_update.nodes.size()); + // We should get an update per node. + ASSERT_EQ(GetSize(ax_tree.GetRoot()), out_update.nodes.size()); - // Try removing some child views and re-adding which should fire some events. + // Try removing some child views and re-adding. content_->RemoveAllChildViews(false /* delete_children */); content_->AddChildView(textfield_); @@ -153,11 +126,38 @@ TEST_F(AXTreeSourceAuraTest, Serialize) { ui::AXTreeUpdate out_update2; ax_serializer.SerializeChanges(textfield_wrapper, &out_update2); - size_t node_count = out_update2.nodes.size(); + // We should have far fewer updates this time around. + ASSERT_EQ(2U, out_update2.nodes.size()); + ASSERT_EQ(ui::AX_ROLE_CLIENT, + out_update2.nodes[0].role); - // We should have far more updates this time around. - ASSERT_GE(node_count, 10U); + ASSERT_EQ(textfield_wrapper->GetID(), out_update2.nodes[1].id); + ASSERT_EQ(ui::AX_ROLE_TEXT_FIELD, + out_update2.nodes[1].role); +} + +TEST_F(AXTreeSourceAshTest, DoDefault) { + AXTreeSourceAsh ax_tree; + + // Grab a wrapper to |DoDefault| (click). + AXAuraObjWrapper* textfield_wrapper = + AXAuraObjCache::GetInstance()->GetOrCreate(textfield_); - ASSERT_EQ(textfield_wrapper->GetID(), out_update2.nodes[node_count - 1].id); - ASSERT_EQ(ui::AX_ROLE_TEXT_FIELD, out_update2.nodes[node_count - 1].role); + // Click and verify focus. + ASSERT_FALSE(textfield_->HasFocus()); + textfield_wrapper->DoDefault(); + ASSERT_TRUE(textfield_->HasFocus()); +} + +TEST_F(AXTreeSourceAshTest, Focus) { + AXTreeSourceAsh ax_tree; + + // Grab a wrapper to focus. + AXAuraObjWrapper* textfield_wrapper = + AXAuraObjCache::GetInstance()->GetOrCreate(textfield_); + + // Focus and verify. + ASSERT_FALSE(textfield_->HasFocus()); + textfield_wrapper->Focus(); + ASSERT_TRUE(textfield_->HasFocus()); } diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc index e220452..1fd3638 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc @@ -24,11 +24,11 @@ #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" #include "chrome/browser/speech/tts_controller.h" #include "chrome/browser/sync/sync_error_notifier_factory_ash.h" +#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" #include "chrome/browser/ui/ash/media_delegate_chromeos.h" #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_window.h" @@ -171,12 +171,12 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate { if (profile) { switch (alert) { case ui::A11Y_ALERT_WINDOW_NEEDED: { - AutomationManagerAura::GetInstance()->HandleAlert( + AutomationManagerAsh::GetInstance()->HandleAlert( profile, l10n_util::GetStringUTF8(IDS_A11Y_ALERT_WINDOW_NEEDED)); break; } case ui::A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED: { - AutomationManagerAura::GetInstance()->HandleAlert( + AutomationManagerAsh::GetInstance()->HandleAlert( profile, l10n_util::GetStringUTF8( IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED)); break; diff --git a/chrome/browser/ui/aura/accessibility/OWNERS b/chrome/browser/ui/aura/accessibility/OWNERS deleted file mode 100644 index c50d5b8..0000000 --- a/chrome/browser/ui/aura/accessibility/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -aboxhall@chromium.org -dmazzoni@chromium.org -dtseng@chromium.org diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 01a0585..daba64b 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc @@ -35,7 +35,6 @@ #endif #if defined(USE_AURA) -#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" #endif @@ -53,6 +52,7 @@ #if defined(USE_ASH) #include "ash/shell.h" #include "ash/wm/window_state.h" +#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" #include "chrome/browser/ui/ash/ash_init.h" #include "chrome/browser/ui/ash/ash_util.h" #endif @@ -213,8 +213,8 @@ bool ChromeViewsDelegate::GetSavedWindowPlacement( void ChromeViewsDelegate::NotifyAccessibilityEvent( views::View* view, ui::AXEvent event_type) { -#if defined(USE_AURA) - AutomationManagerAura::GetInstance()->HandleEvent( +#if defined(USE_ASH) + AutomationManagerAsh::GetInstance()->HandleEvent( GetProfileForWindow(view->GetWidget()), view, event_type); #endif } diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index a3fd14c..85692c6 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -1147,6 +1147,12 @@ ], # Cross-platform ash sources. 'chrome_browser_ui_ash_sources': [ + 'browser/ui/ash/accessibility/automation_manager_ash.cc', + 'browser/ui/ash/accessibility/automation_manager_ash.h', + 'browser/ui/ash/accessibility/ax_root_obj_wrapper.cc', + 'browser/ui/ash/accessibility/ax_root_obj_wrapper.h', + 'browser/ui/ash/accessibility/ax_tree_source_ash.cc', + 'browser/ui/ash/accessibility/ax_tree_source_ash.h', 'browser/ui/ash/app_list/app_list_controller_ash.cc', 'browser/ui/ash/app_list/app_list_controller_ash.h', 'browser/ui/ash/app_list/app_list_service_ash.cc', @@ -1283,12 +1289,6 @@ ], # Cross-platform aura sources. 'chrome_browser_ui_aura_sources': [ - 'browser/ui/aura/accessibility/automation_manager_aura.cc', - 'browser/ui/aura/accessibility/automation_manager_aura.h', - 'browser/ui/aura/accessibility/ax_root_obj_wrapper.cc', - 'browser/ui/aura/accessibility/ax_root_obj_wrapper.h', - 'browser/ui/aura/accessibility/ax_tree_source_aura.cc', - 'browser/ui/aura/accessibility/ax_tree_source_aura.h', 'browser/ui/aura/chrome_browser_main_extra_parts_aura.cc', 'browser/ui/aura/chrome_browser_main_extra_parts_aura.h', 'browser/ui/aura/native_window_tracker_aura.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 453ac11..9d6ddb2 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -938,7 +938,7 @@ # Ash implies the app list is enabled (only disabled on mobile). 'browser/ui/app_list/search/app_search_provider_unittest.cc', 'browser/ui/app_list/search/history_unittest.cc', - 'browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc', + 'browser/ui/ash/accessibility/ax_tree_source_ash_unittest.cc', 'browser/ui/ash/chrome_screenshot_grabber_unittest.cc', 'browser/ui/ash/ime_controller_chromeos_unittest.cc', 'browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc', diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js index 7a2b903..a6d3d9a 100644 --- a/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js @@ -42,28 +42,14 @@ function runWithDocument(docString, callback) { function setupAndRunTests(allTests, opt_docString) { function runTestInternal() { - chrome.test.runTests(allTests); + chrome.automation.getDesktop(function(rootNodeArg) { + rootNode = rootNodeArg; + chrome.test.runTests(allTests); + }); } - chrome.automation.getDesktop(function(rootNodeArg) { - rootNode = rootNodeArg; - - // Only run the test when the window containing the new tab loads. - rootNodeArg.addEventListener( - chrome.automation.EventType.childrenChanged, - function(evt) { - var subroot = evt.target.firstChild; - if (!opt_docString || !subroot) - return; - - if (subroot.role == 'rootWebArea' && - subroot.attributes.docUrl.indexOf(opt_docString) != -1) - runTestInternal(); - }, - true); - if (opt_docString) - runWithDocument(opt_docString, null); - else - runTestInternal(); - }); + if (opt_docString) + runWithDocument(opt_docString, runTestInternal); + else + runTestInternal(); } diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js index cf1db70..75fb983 100644 --- a/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js @@ -6,7 +6,7 @@ var allTests = [ function testGetDesktop() { chrome.automation.getDesktop(function(rootNode) { assertEq(RoleType.desktop, rootNode.role); - assertEq(undefined, rootNode.firstChild); + assertEq(RoleType.window, rootNode.firstChild.role); chrome.test.succeed(); }); }, diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js index 90e1711..a2f61c9 100644 --- a/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js @@ -22,14 +22,28 @@ var allTests = [ function testLoadTabs() { var webViews = getAllWebViews(); assertEq(2, webViews.length); - var subroot = webViews[1].firstChild; - assertEq(webViews[1], subroot.parent); - assertEq(subroot, subroot.parent.children[0]); - var button = subroot.firstChild.firstChild; - assertEq(chrome.automation.RoleType.button, button.role); - var input = subroot.firstChild.lastChild.previousSibling; - assertEq(chrome.automation.RoleType.textField, input.role); - chrome.test.succeed(); + + // Test spins up more quickly than the load; listen for the childrenChanged + // event. + function childrenChangedListener(evt) { + var subroot = webViews[1].firstChild; + assertEq(evt.target, subroot.parent); + assertEq(subroot, subroot.parent.children[0]); + + var button = subroot.firstChild.firstChild; + assertEq(chrome.automation.RoleType.button, button.role); + + var input = subroot.firstChild.lastChild.previousSibling; + assertEq(chrome.automation.RoleType.textField, input.role); + webViews[1].removeEventListener( + chrome.automation.EventType.childrenChanged, + childrenChangedListener), true; + chrome.test.succeed(); + } + webViews[1].addEventListener( + chrome.automation.EventType.childrenChanged, + childrenChangedListener, + true); }, function testSubevents() { diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json b/chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json index 8cac658..e1f52b3 100644 --- a/chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json @@ -3,6 +3,5 @@ "version": "0.1", "manifest_version": 2, "description": "Tests for the Automation API.", - "permissions": [ "windows" ], "automation": {"desktop": true} } diff --git a/ui/views/accessibility/ax_aura_obj_cache.cc b/ui/views/accessibility/ax_aura_obj_cache.cc index 8d5937b..05f1868 100644 --- a/ui/views/accessibility/ax_aura_obj_cache.cc +++ b/ui/views/accessibility/ax_aura_obj_cache.cc @@ -76,15 +76,6 @@ void AXAuraObjCache::Remove(int32 id) { delete obj; } -void AXAuraObjCache::GetTopLevelWindows( - std::vector<AXAuraObjWrapper*>* children) { - for (std::map<aura::Window*, int32>::iterator it = window_to_id_map_.begin(); - it != window_to_id_map_.end(); ++it) { - if (!it->first->parent()) - children->push_back(GetOrCreate(it->first)); - } -} - AXAuraObjCache::AXAuraObjCache() : current_id_(1), is_destroying_(false) { } diff --git a/ui/views/accessibility/ax_aura_obj_cache.h b/ui/views/accessibility/ax_aura_obj_cache.h index f3e35a6..a8316b5 100644 --- a/ui/views/accessibility/ax_aura_obj_cache.h +++ b/ui/views/accessibility/ax_aura_obj_cache.h @@ -6,7 +6,6 @@ #define UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ #include <map> -#include <vector> #include "base/basictypes.h" #include "ui/views/views_export.h" @@ -53,9 +52,6 @@ class VIEWS_EXPORT AXAuraObjCache { // Remove a cached entry based on an id. void Remove(int32 id); - // Get all top level windows this cache knows about. - void GetTopLevelWindows(std::vector<AXAuraObjWrapper*>* children); - // Indicates if this object's currently being destroyed. bool is_destroying() { return is_destroying_; } |