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

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: Actions. Created 5 years, 8 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 << message_; 139 << message_;
134 } 140 }
135 141
136 IN_PROC_BROWSER_TEST_F(AutomationApiTest, TabsAutomationHostsPermissions) { 142 IN_PROC_BROWSER_TEST_F(AutomationApiTest, TabsAutomationHostsPermissions) {
137 StartEmbeddedTestServer(); 143 StartEmbeddedTestServer();
138 ASSERT_TRUE(RunExtensionSubtest( 144 ASSERT_TRUE(RunExtensionSubtest(
139 "automation/tests/tabs_automation_hosts", "permissions.html")) 145 "automation/tests/tabs_automation_hosts", "permissions.html"))
140 << message_; 146 << message_;
141 } 147 }
142 148
143 #if defined(OS_CHROMEOS) 149 #if defined(USE_AURA)
144 IN_PROC_BROWSER_TEST_F(AutomationApiTest, Desktop) { 150 IN_PROC_BROWSER_TEST_F(AutomationApiTest, Desktop) {
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
160 #if defined(OS_CHROMEOS)
154 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopActions) { 161 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopActions) {
162 AutomationManagerAura::GetInstance()->Enable(browser()->profile());
163 // Trigger the shelf subtree to be computed.
164 ash::Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled(
165 ash::FOCUS_SHELF);
166
155 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "actions.html")) 167 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "actions.html"))
156 << message_; 168 << message_;
157 } 169 }
170 #endif // defined(OS_CHROMEOS)
158 171
159 // http://crbug.com/435449
160 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) { 172 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) {
161 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "load_tabs.html")) 173 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "load_tabs.html"))
162 << message_; 174 << message_;
163 } 175 }
164 #else 176 #else
165 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotSupported) { 177 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotSupported) {
166 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", 178 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop",
167 "desktop_not_supported.html")) << message_; 179 "desktop_not_supported.html"))
180 << message_;
168 } 181 }
169 #endif 182 #endif
170 183
171 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) { 184 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) {
172 StartEmbeddedTestServer(); 185 StartEmbeddedTestServer();
173 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html")) 186 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html"))
174 << message_; 187 << message_;
175 } 188 }
176 189
177 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) { 190 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 "automationInternal.enableTab", 531 "automationInternal.enableTab",
519 FakeAutomationInternalEnableTabFunctionFactory)); 532 FakeAutomationInternalEnableTabFunctionFactory));
520 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( 533 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction(
521 "automationInternal.performAction", 534 "automationInternal.performAction",
522 FakeAutomationInternalPerformActionFunctionFactory)); 535 FakeAutomationInternalPerformActionFunctionFactory));
523 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", 536 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated",
524 "generated_trees.html")) << message_; 537 "generated_trees.html")) << message_;
525 } 538 }
526 539
527 } // namespace extensions 540 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698