Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/extensions/api/automation/automation_apitest.cc

Issue 1003283002: Enable chrome.automation.getDesktop on all aura platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" 8 #include "chrome/browser/extensions/api/automation_internal/automation_util.h"
9 #include "chrome/browser/extensions/chrome_extension_function.h" 9 #include "chrome/browser/extensions/chrome_extension_function.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/extensions/api/automation_internal.h" 14 #include "chrome/common/extensions/api/automation_internal.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "content/public/browser/ax_event_notification_details.h" 16 #include "content/public/browser/ax_event_notification_details.h"
17 #include "content/public/browser/render_widget_host.h" 17 #include "content/public/browser/render_widget_host.h"
18 #include "content/public/browser/render_widget_host_view.h" 18 #include "content/public/browser/render_widget_host_view.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "extensions/test/extension_test_message_listener.h" 20 #include "extensions/test/extension_test_message_listener.h"
21 #include "net/dns/mock_host_resolver.h" 21 #include "net/dns/mock_host_resolver.h"
22 #include "net/test/embedded_test_server/embedded_test_server.h" 22 #include "net/test/embedded_test_server/embedded_test_server.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 #include "ui/accessibility/ax_node.h" 24 #include "ui/accessibility/ax_node.h"
25 #include "ui/accessibility/ax_serializable_tree.h" 25 #include "ui/accessibility/ax_serializable_tree.h"
26 #include "ui/accessibility/ax_tree.h" 26 #include "ui/accessibility/ax_tree.h"
27 #include "ui/accessibility/ax_tree_serializer.h" 27 #include "ui/accessibility/ax_tree_serializer.h"
28 #include "ui/accessibility/tree_generator.h" 28 #include "ui/accessibility/tree_generator.h"
29 29
30 #if defined(OS_CHROMEOS)
31 #include "ash/accelerators/accelerator_controller.h"
32 #include "ash/shell.h"
33 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
34 #endif
35
30 namespace extensions { 36 namespace extensions {
31 37
32 namespace { 38 namespace {
33 static const char kDomain[] = "a.com"; 39 static const char kDomain[] = "a.com";
34 static const char kSitesDir[] = "automation/sites"; 40 static const char kSitesDir[] = "automation/sites";
35 static const char kGotTree[] = "got_tree"; 41 static const char kGotTree[] = "got_tree";
36 } // anonymous namespace 42 } // anonymous namespace
37 43
38 class AutomationApiTest : public ExtensionApiTest { 44 class AutomationApiTest : public ExtensionApiTest {
39 protected: 45 protected:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "desktop.html")) 151 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "desktop.html"))
146 << message_; 152 << message_;
147 } 153 }
148 154
149 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotRequested) { 155 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotRequested) {
150 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", 156 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs",
151 "desktop_not_requested.html")) << message_; 157 "desktop_not_requested.html")) << message_;
152 } 158 }
153 159
154 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopActions) { 160 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopActions) {
161 AutomationManagerAura::GetInstance()->Enable(browser()->profile());
162 // Trigger the shelf subtree to be computed.
163 ash::Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled(
164 ash::FOCUS_SHELF);
165
155 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "actions.html")) 166 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "actions.html"))
156 << message_; 167 << message_;
157 } 168 }
158 169
159 // http://crbug.com/435449 170 // http://crbug.com/435449
dmazzoni 2015/03/26 18:44:58 nit: remove this line since the test isn't failing
160 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) { 171 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) {
161 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "load_tabs.html")) 172 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "load_tabs.html"))
162 << message_; 173 << message_;
163 } 174 }
164 #else 175 #else
165 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotSupported) { 176 IN_PROC_BROWSER_TEST_F(AutomationApiTest, LazyDesktop) {
166 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", 177 ASSERT_TRUE(
167 "desktop_not_supported.html")) << message_; 178 RunExtensionSubtest("automation/tests/desktop", "lazy_desktop.html"))
179 << message_;
168 } 180 }
169 #endif 181 #endif
170 182
171 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) { 183 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) {
172 StartEmbeddedTestServer(); 184 StartEmbeddedTestServer();
173 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html")) 185 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html"))
174 << message_; 186 << message_;
175 } 187 }
176 188
177 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) { 189 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 "automationInternal.enableTab", 530 "automationInternal.enableTab",
519 FakeAutomationInternalEnableTabFunctionFactory)); 531 FakeAutomationInternalEnableTabFunctionFactory));
520 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( 532 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction(
521 "automationInternal.performAction", 533 "automationInternal.performAction",
522 FakeAutomationInternalPerformActionFunctionFactory)); 534 FakeAutomationInternalPerformActionFunctionFactory));
523 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", 535 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated",
524 "generated_trees.html")) << message_; 536 "generated_trees.html")) << message_;
525 } 537 }
526 538
527 } // namespace extensions 539 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698