| OLD | NEW |
| 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 Loading... |
| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 "desktop_not_supported.html")) << message_; | 166 "desktop_not_supported.html")) << message_; |
| 171 } | 167 } |
| 172 #endif | 168 #endif |
| 173 | 169 |
| 174 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) { | 170 IN_PROC_BROWSER_TEST_F(AutomationApiTest, CloseTab) { |
| 175 StartEmbeddedTestServer(); | 171 StartEmbeddedTestServer(); |
| 176 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html")) | 172 ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "close_tab.html")) |
| 177 << message_; | 173 << message_; |
| 178 } | 174 } |
| 179 | 175 |
| 176 IN_PROC_BROWSER_TEST_F(AutomationApiTest, QuerySelector) { |
| 177 StartEmbeddedTestServer(); |
| 178 ASSERT_TRUE( |
| 179 RunExtensionSubtest("automation/tests/tabs", "queryselector.html")) |
| 180 << message_; |
| 181 } |
| 182 |
| 180 static const int kPid = 1; | 183 static const int kPid = 1; |
| 181 static const int kTab0Rid = 1; | 184 static const int kTab0Rid = 1; |
| 182 static const int kTab1Rid = 2; | 185 static const int kTab1Rid = 2; |
| 183 | 186 |
| 184 using content::BrowserContext; | 187 using content::BrowserContext; |
| 185 | 188 |
| 186 typedef ui::AXTreeSerializer<const ui::AXNode*> TreeSerializer; | 189 typedef ui::AXTreeSerializer<const ui::AXNode*> TreeSerializer; |
| 187 typedef ui::AXTreeSource<const ui::AXNode*> TreeSource; | 190 typedef ui::AXTreeSource<const ui::AXNode*> TreeSource; |
| 188 | 191 |
| 189 #define AX_EVENT_ASSERT_EQUAL ui::AX_EVENT_LOAD_COMPLETE | 192 #define AX_EVENT_ASSERT_EQUAL ui::AX_EVENT_LOAD_COMPLETE |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 "automationInternal.enableTab", | 498 "automationInternal.enableTab", |
| 496 FakeAutomationInternalEnableTabFunctionFactory)); | 499 FakeAutomationInternalEnableTabFunctionFactory)); |
| 497 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( | 500 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( |
| 498 "automationInternal.performAction", | 501 "automationInternal.performAction", |
| 499 FakeAutomationInternalPerformActionFunctionFactory)); | 502 FakeAutomationInternalPerformActionFunctionFactory)); |
| 500 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", | 503 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", |
| 501 "generated_trees.html")) << message_; | 504 "generated_trees.html")) << message_; |
| 502 } | 505 } |
| 503 | 506 |
| 504 } // namespace extensions | 507 } // namespace extensions |
| OLD | NEW |