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

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

Issue 655273005: Implement AutomationNode.querySelector(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Use enums instead of strings for error messages Created 6 years, 1 month 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"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 void StartEmbeddedTestServer() { 50 void StartEmbeddedTestServer() {
51 base::FilePath test_data; 51 base::FilePath test_data;
52 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data)); 52 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data));
53 embedded_test_server()->ServeFilesFromDirectory( 53 embedded_test_server()->ServeFilesFromDirectory(
54 test_data.AppendASCII("extensions/api_test") 54 test_data.AppendASCII("extensions/api_test")
55 .AppendASCII(kSitesDir)); 55 .AppendASCII(kSitesDir));
56 ASSERT_TRUE(ExtensionApiTest::StartEmbeddedTestServer()); 56 ASSERT_TRUE(ExtensionApiTest::StartEmbeddedTestServer());
57 host_resolver()->AddRule("*", embedded_test_server()->base_url().host()); 57 host_resolver()->AddRule("*", embedded_test_server()->base_url().host());
58 } 58 }
59 59
60 void LoadPage() {
61 StartEmbeddedTestServer();
62 const GURL url = GetURLForPath(kDomain, "/index.html");
63 ui_test_utils::NavigateToURL(browser(), url);
64 }
65
66 public: 60 public:
67 virtual void SetUpInProcessBrowserTestFixture() override { 61 virtual void SetUpInProcessBrowserTestFixture() override {
68 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 62 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
69 } 63 }
70 }; 64 };
71 65
72 IN_PROC_BROWSER_TEST_F(AutomationApiTest, TestRendererAccessibilityEnabled) { 66 IN_PROC_BROWSER_TEST_F(AutomationApiTest, TestRendererAccessibilityEnabled) {
73 LoadPage(); 67 StartEmbeddedTestServer();
68 const GURL url = GetURLForPath(kDomain, "/index.html");
69 ui_test_utils::NavigateToURL(browser(), url);
74 70
75 ASSERT_EQ(1, browser()->tab_strip_model()->count()); 71 ASSERT_EQ(1, browser()->tab_strip_model()->count());
76 content::WebContents* const tab = 72 content::WebContents* const tab =
77 browser()->tab_strip_model()->GetWebContentsAt(0); 73 browser()->tab_strip_model()->GetWebContentsAt(0);
78 ASSERT_FALSE(tab->IsFullAccessibilityModeForTesting()); 74 ASSERT_FALSE(tab->IsFullAccessibilityModeForTesting());
79 ASSERT_FALSE(tab->IsTreeOnlyAccessibilityModeForTesting()); 75 ASSERT_FALSE(tab->IsTreeOnlyAccessibilityModeForTesting());
80 76
81 base::FilePath extension_path = 77 base::FilePath extension_path =
82 test_data_dir_.AppendASCII("automation/tests/basic"); 78 test_data_dir_.AppendASCII("automation/tests/basic");
83 ExtensionTestMessageListener got_tree(kGotTree, false /* no reply */); 79 ExtensionTestMessageListener got_tree(kGotTree, false /* no reply */);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 "desktop_not_supported.html")) << message_; 161 "desktop_not_supported.html")) << message_;
166 } 162 }
167 #endif 163 #endif
168 164
169 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) { 165 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) {
170 StartEmbeddedTestServer(); 166 StartEmbeddedTestServer();
171 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html")) 167 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html"))
172 << message_; 168 << message_;
173 } 169 }
174 170
171 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) {
172 StartEmbeddedTestServer();
173 ASSERT_TRUE(
174 RunExtensionSubtest("automation/tests/tabs", "queryselector.html"))
175 << message_;
176 }
177
175 static const int kPid = 1; 178 static const int kPid = 1;
176 static const int kTab0Rid = 1; 179 static const int kTab0Rid = 1;
177 static const int kTab1Rid = 2; 180 static const int kTab1Rid = 2;
178 181
179 using content::BrowserContext; 182 using content::BrowserContext;
180 183
181 typedef ui::AXTreeSerializer<const ui::AXNode*> TreeSerializer; 184 typedef ui::AXTreeSerializer<const ui::AXNode*> TreeSerializer;
182 typedef ui::AXTreeSource<const ui::AXNode*> TreeSource; 185 typedef ui::AXTreeSource<const ui::AXNode*> TreeSource;
183 186
184 #define AX_EVENT_ASSERT_EQUAL ui::AX_EVENT_LOAD_COMPLETE 187 #define AX_EVENT_ASSERT_EQUAL ui::AX_EVENT_LOAD_COMPLETE
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 "automationInternal.enableTab", 494 "automationInternal.enableTab",
492 FakeAutomationInternalEnableTabFunctionFactory)); 495 FakeAutomationInternalEnableTabFunctionFactory));
493 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( 496 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction(
494 "automationInternal.performAction", 497 "automationInternal.performAction",
495 FakeAutomationInternalPerformActionFunctionFactory)); 498 FakeAutomationInternalPerformActionFunctionFactory));
496 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", 499 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated",
497 "generated_trees.html")) << message_; 500 "generated_trees.html")) << message_;
498 } 501 }
499 502
500 } // namespace extensions 503 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698