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

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

Issue 1040863002: Revert "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
36 namespace extensions { 30 namespace extensions {
37 31
38 namespace { 32 namespace {
39 static const char kDomain[] = "a.com"; 33 static const char kDomain[] = "a.com";
40 static const char kSitesDir[] = "automation/sites"; 34 static const char kSitesDir[] = "automation/sites";
41 static const char kGotTree[] = "got_tree"; 35 static const char kGotTree[] = "got_tree";
42 } // anonymous namespace 36 } // anonymous namespace
43 37
44 class AutomationApiTest : public ExtensionApiTest { 38 class AutomationApiTest : public ExtensionApiTest {
45 protected: 39 protected:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 << message_; 133 << message_;
140 } 134 }
141 135
142 IN_PROC_BROWSER_TEST_F(AutomationApiTest, TabsAutomationHostsPermissions) { 136 IN_PROC_BROWSER_TEST_F(AutomationApiTest, TabsAutomationHostsPermissions) {
143 StartEmbeddedTestServer(); 137 StartEmbeddedTestServer();
144 ASSERT_TRUE(RunExtensionSubtest( 138 ASSERT_TRUE(RunExtensionSubtest(
145 "automation/tests/tabs_automation_hosts", "permissions.html")) 139 "automation/tests/tabs_automation_hosts", "permissions.html"))
146 << message_; 140 << message_;
147 } 141 }
148 142
149 #if defined(USE_AURA) 143 #if defined(OS_CHROMEOS)
150 IN_PROC_BROWSER_TEST_F(AutomationApiTest, Desktop) { 144 IN_PROC_BROWSER_TEST_F(AutomationApiTest, Desktop) {
151 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "desktop.html")) 145 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "desktop.html"))
152 << message_; 146 << message_;
153 } 147 }
154 148
155 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotRequested) { 149 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotRequested) {
156 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", 150 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs",
157 "desktop_not_requested.html")) << message_; 151 "desktop_not_requested.html")) << message_;
158 } 152 }
159 153
160 #if defined(OS_CHROMEOS)
161 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopActions) { 154 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
167 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "actions.html")) 155 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "actions.html"))
168 << message_; 156 << message_;
169 } 157 }
170 #endif // defined(OS_CHROMEOS)
171 158
159 // http://crbug.com/435449
172 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) { 160 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopLoadTabs) {
173 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "load_tabs.html")) 161 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "load_tabs.html"))
174 << message_; 162 << message_;
175 } 163 }
176 #else 164 #else
177 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotSupported) { 165 IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopNotSupported) {
178 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", 166 ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop",
179 "desktop_not_supported.html")) 167 "desktop_not_supported.html")) << message_;
180 << message_;
181 } 168 }
182 #endif 169 #endif
183 170
184 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) { 171 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) {
185 StartEmbeddedTestServer(); 172 StartEmbeddedTestServer();
186 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html")) 173 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html"))
187 << message_; 174 << message_;
188 } 175 }
189 176
190 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) { 177 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 "automationInternal.enableTab", 518 "automationInternal.enableTab",
532 FakeAutomationInternalEnableTabFunctionFactory)); 519 FakeAutomationInternalEnableTabFunctionFactory));
533 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( 520 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction(
534 "automationInternal.performAction", 521 "automationInternal.performAction",
535 FakeAutomationInternalPerformActionFunctionFactory)); 522 FakeAutomationInternalPerformActionFunctionFactory));
536 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", 523 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated",
537 "generated_trees.html")) << message_; 524 "generated_trees.html")) << message_;
538 } 525 }
539 526
540 } // namespace extensions 527 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698