OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 38 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
39 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
40 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
42 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
43 #include "chrome/test/base/in_process_browser_test.h" | 43 #include "chrome/test/base/in_process_browser_test.h" |
44 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" | 44 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" |
45 #include "chrome/test/base/ui_test_utils.h" | 45 #include "chrome/test/base/ui_test_utils.h" |
46 #include "components/app_modal/javascript_app_modal_dialog.h" | 46 #include "components/app_modal/javascript_app_modal_dialog.h" |
47 #include "components/app_modal/native_app_modal_dialog.h" | 47 #include "components/app_modal/native_app_modal_dialog.h" |
| 48 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 49 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 50 #include "components/autofill/core/browser/autofill_manager.h" |
| 51 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" |
48 #include "components/prefs/pref_service.h" | 52 #include "components/prefs/pref_service.h" |
49 #include "content/public/browser/child_process_data.h" | 53 #include "content/public/browser/child_process_data.h" |
50 #include "content/public/browser/content_browser_client.h" | 54 #include "content/public/browser/content_browser_client.h" |
51 #include "content/public/browser/devtools_agent_host.h" | 55 #include "content/public/browser/devtools_agent_host.h" |
52 #include "content/public/browser/notification_registrar.h" | 56 #include "content/public/browser/notification_registrar.h" |
53 #include "content/public/browser/notification_service.h" | 57 #include "content/public/browser/notification_service.h" |
54 #include "content/public/browser/render_view_host.h" | 58 #include "content/public/browser/render_view_host.h" |
55 #include "content/public/browser/render_widget_host.h" | 59 #include "content/public/browser/render_widget_host.h" |
56 #include "content/public/browser/render_widget_host_view.h" | 60 #include "content/public/browser/render_widget_host_view.h" |
57 #include "content/public/browser/url_data_source.h" | 61 #include "content/public/browser/url_data_source.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const char kSharedWorkerTestPage[] = | 117 const char kSharedWorkerTestPage[] = |
114 "files/workers/workers_ui_shared_worker.html"; | 118 "files/workers/workers_ui_shared_worker.html"; |
115 const char kSharedWorkerTestWorker[] = | 119 const char kSharedWorkerTestWorker[] = |
116 "files/workers/workers_ui_shared_worker.js"; | 120 "files/workers/workers_ui_shared_worker.js"; |
117 const char kReloadSharedWorkerTestPage[] = | 121 const char kReloadSharedWorkerTestPage[] = |
118 "files/workers/debug_shared_worker_initialization.html"; | 122 "files/workers/debug_shared_worker_initialization.html"; |
119 const char kReloadSharedWorkerTestWorker[] = | 123 const char kReloadSharedWorkerTestWorker[] = |
120 "files/workers/debug_shared_worker_initialization.js"; | 124 "files/workers/debug_shared_worker_initialization.js"; |
121 const char kEmulateNetworkConditionsPage[] = | 125 const char kEmulateNetworkConditionsPage[] = |
122 "files/devtools/emulate_network_conditions.html"; | 126 "files/devtools/emulate_network_conditions.html"; |
| 127 const char kDispatchKeyEventShowsAutoFill[] = |
| 128 "files/devtools/dispatch_key_event_shows_auto_fill.html"; |
123 | 129 |
124 template <typename... T> | 130 template <typename... T> |
125 void DispatchOnTestSuiteSkipCheck(DevToolsWindow* window, | 131 void DispatchOnTestSuiteSkipCheck(DevToolsWindow* window, |
126 const char* method, | 132 const char* method, |
127 T... args) { | 133 T... args) { |
128 RenderViewHost* rvh = DevToolsWindowTesting::Get(window) | 134 RenderViewHost* rvh = DevToolsWindowTesting::Get(window) |
129 ->main_web_contents() | 135 ->main_web_contents() |
130 ->GetRenderViewHost(); | 136 ->GetRenderViewHost(); |
131 std::string result; | 137 std::string result; |
132 const char* args_array[] = {method, args...}; | 138 const char* args_array[] = {method, args...}; |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 } | 1194 } |
1189 | 1195 |
1190 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDeviceEmulation) { | 1196 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDeviceEmulation) { |
1191 RunTest("testDeviceMetricsOverrides", "about:blank"); | 1197 RunTest("testDeviceMetricsOverrides", "about:blank"); |
1192 } | 1198 } |
1193 | 1199 |
1194 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventDoesNotCrash) { | 1200 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventDoesNotCrash) { |
1195 RunTest("testDispatchKeyEventDoesNotCrash", "about:blank"); | 1201 RunTest("testDispatchKeyEventDoesNotCrash", "about:blank"); |
1196 } | 1202 } |
1197 | 1203 |
| 1204 class AutofillManagerTestDelegateDevtoolsImpl |
| 1205 : public autofill::AutofillManagerTestDelegate { |
| 1206 public: |
| 1207 explicit AutofillManagerTestDelegateDevtoolsImpl( |
| 1208 WebContents* inspectedContents) |
| 1209 : inspected_contents_(inspectedContents) {} |
| 1210 ~AutofillManagerTestDelegateDevtoolsImpl() override {} |
| 1211 |
| 1212 void DidPreviewFormData() override {} |
| 1213 |
| 1214 void DidFillFormData() override {} |
| 1215 |
| 1216 void DidShowSuggestions() override { |
| 1217 ASSERT_TRUE(content::ExecuteScript( |
| 1218 inspected_contents_, "console.log('didShowSuggestions');")); |
| 1219 } |
| 1220 |
| 1221 void OnTextFieldChanged() override {} |
| 1222 |
| 1223 private: |
| 1224 WebContents* inspected_contents_; |
| 1225 |
| 1226 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTestDelegateDevtoolsImpl); |
| 1227 }; |
| 1228 |
| 1229 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventShowsAutoFill) { |
| 1230 OpenDevToolsWindow(kDispatchKeyEventShowsAutoFill, false); |
| 1231 |
| 1232 autofill::ContentAutofillDriver* autofill_driver = |
| 1233 autofill::ContentAutofillDriverFactory::FromWebContents(GetInspectedTab()) |
| 1234 ->DriverForFrame(GetInspectedTab()->GetMainFrame()); |
| 1235 autofill::AutofillManager* autofill_manager = |
| 1236 autofill_driver->autofill_manager(); |
| 1237 AutofillManagerTestDelegateDevtoolsImpl autoFillTestDelegate( |
| 1238 GetInspectedTab()); |
| 1239 autofill_manager->SetTestDelegate(&autoFillTestDelegate); |
| 1240 |
| 1241 RunTestFunction(window_, "testDispatchKeyEventShowsAutoFill"); |
| 1242 CloseDevToolsWindow(); |
| 1243 } |
| 1244 |
1198 // Tests that settings are stored in profile correctly. | 1245 // Tests that settings are stored in profile correctly. |
1199 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) { | 1246 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) { |
1200 OpenDevToolsWindow("about:blank", true); | 1247 OpenDevToolsWindow("about:blank", true); |
1201 RunTestFunction(window_, "testSettings"); | 1248 RunTestFunction(window_, "testSettings"); |
1202 CloseDevToolsWindow(); | 1249 CloseDevToolsWindow(); |
1203 } | 1250 } |
1204 | 1251 |
1205 // Tests that external navigation from inspector page is always handled by | 1252 // Tests that external navigation from inspector page is always handled by |
1206 // DevToolsWindow and results in inspected page navigation. | 1253 // DevToolsWindow and results in inspected page navigation. |
1207 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { | 1254 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 | 1613 |
1567 DevToolsWindowTesting::CloseDevToolsWindowSync(window); | 1614 DevToolsWindowTesting::CloseDevToolsWindowSync(window); |
1568 content::WebUIControllerFactory::UnregisterFactoryForTesting(&test_factory); | 1615 content::WebUIControllerFactory::UnregisterFactoryForTesting(&test_factory); |
1569 } | 1616 } |
1570 | 1617 |
1571 // Tests scripts panel showing. | 1618 // Tests scripts panel showing. |
1572 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsSharedWorker) { | 1619 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsSharedWorker) { |
1573 RunTest("testDevToolsSharedWorker", url::kAboutBlankURL); | 1620 RunTest("testDevToolsSharedWorker", url::kAboutBlankURL); |
1574 } | 1621 } |
1575 | 1622 |
OLD | NEW |