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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/common/chrome_paths.h" | 43 #include "chrome/common/chrome_paths.h" |
44 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/common/extensions/extension_process_policy.h" | 45 #include "chrome/common/extensions/extension_process_policy.h" |
46 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
47 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
48 #include "chrome/test/base/in_process_browser_test.h" | 48 #include "chrome/test/base/in_process_browser_test.h" |
49 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" | 49 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" |
50 #include "chrome/test/base/ui_test_utils.h" | 50 #include "chrome/test/base/ui_test_utils.h" |
51 #include "components/app_modal/javascript_app_modal_dialog.h" | 51 #include "components/app_modal/javascript_app_modal_dialog.h" |
52 #include "components/app_modal/native_app_modal_dialog.h" | 52 #include "components/app_modal/native_app_modal_dialog.h" |
53 #include "components/autofill/content/browser/content_autofill_driver.h" | |
54 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | |
55 #include "components/autofill/core/browser/autofill_manager.h" | |
56 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" | |
57 #include "components/prefs/pref_service.h" | 53 #include "components/prefs/pref_service.h" |
58 #include "content/public/browser/child_process_data.h" | 54 #include "content/public/browser/child_process_data.h" |
59 #include "content/public/browser/content_browser_client.h" | 55 #include "content/public/browser/content_browser_client.h" |
60 #include "content/public/browser/devtools_agent_host.h" | 56 #include "content/public/browser/devtools_agent_host.h" |
61 #include "content/public/browser/notification_registrar.h" | 57 #include "content/public/browser/notification_registrar.h" |
62 #include "content/public/browser/notification_service.h" | 58 #include "content/public/browser/notification_service.h" |
63 #include "content/public/browser/render_frame_host.h" | 59 #include "content/public/browser/render_frame_host.h" |
64 #include "content/public/browser/render_view_host.h" | 60 #include "content/public/browser/render_view_host.h" |
65 #include "content/public/browser/render_widget_host.h" | 61 #include "content/public/browser/render_widget_host.h" |
66 #include "content/public/browser/render_widget_host_view.h" | 62 #include "content/public/browser/render_widget_host_view.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 const char kSharedWorkerTestPage[] = | 122 const char kSharedWorkerTestPage[] = |
127 "files/workers/workers_ui_shared_worker.html"; | 123 "files/workers/workers_ui_shared_worker.html"; |
128 const char kSharedWorkerTestWorker[] = | 124 const char kSharedWorkerTestWorker[] = |
129 "files/workers/workers_ui_shared_worker.js"; | 125 "files/workers/workers_ui_shared_worker.js"; |
130 const char kReloadSharedWorkerTestPage[] = | 126 const char kReloadSharedWorkerTestPage[] = |
131 "files/workers/debug_shared_worker_initialization.html"; | 127 "files/workers/debug_shared_worker_initialization.html"; |
132 const char kReloadSharedWorkerTestWorker[] = | 128 const char kReloadSharedWorkerTestWorker[] = |
133 "files/workers/debug_shared_worker_initialization.js"; | 129 "files/workers/debug_shared_worker_initialization.js"; |
134 const char kEmulateNetworkConditionsPage[] = | 130 const char kEmulateNetworkConditionsPage[] = |
135 "files/devtools/emulate_network_conditions.html"; | 131 "files/devtools/emulate_network_conditions.html"; |
136 const char kDispatchKeyEventShowsAutoFill[] = | |
137 "files/devtools/dispatch_key_event_shows_auto_fill.html"; | |
138 | 132 |
139 template <typename... T> | 133 template <typename... T> |
140 void DispatchOnTestSuiteSkipCheck(DevToolsWindow* window, | 134 void DispatchOnTestSuiteSkipCheck(DevToolsWindow* window, |
141 const char* method, | 135 const char* method, |
142 T... args) { | 136 T... args) { |
143 RenderViewHost* rvh = DevToolsWindowTesting::Get(window) | 137 RenderViewHost* rvh = DevToolsWindowTesting::Get(window) |
144 ->main_web_contents() | 138 ->main_web_contents() |
145 ->GetRenderViewHost(); | 139 ->GetRenderViewHost(); |
146 std::string result; | 140 std::string result; |
147 const char* args_array[] = {method, args...}; | 141 const char* args_array[] = {method, args...}; |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 } | 1689 } |
1696 | 1690 |
1697 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDeviceEmulation) { | 1691 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDeviceEmulation) { |
1698 RunTest("testDeviceMetricsOverrides", "about:blank"); | 1692 RunTest("testDeviceMetricsOverrides", "about:blank"); |
1699 } | 1693 } |
1700 | 1694 |
1701 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventDoesNotCrash) { | 1695 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventDoesNotCrash) { |
1702 RunTest("testDispatchKeyEventDoesNotCrash", "about:blank"); | 1696 RunTest("testDispatchKeyEventDoesNotCrash", "about:blank"); |
1703 } | 1697 } |
1704 | 1698 |
1705 class AutofillManagerTestDelegateDevtoolsImpl | |
1706 : public autofill::AutofillManagerTestDelegate { | |
1707 public: | |
1708 explicit AutofillManagerTestDelegateDevtoolsImpl( | |
1709 WebContents* inspectedContents) | |
1710 : inspected_contents_(inspectedContents) {} | |
1711 ~AutofillManagerTestDelegateDevtoolsImpl() override {} | |
1712 | |
1713 void DidPreviewFormData() override {} | |
1714 | |
1715 void DidFillFormData() override {} | |
1716 | |
1717 void DidShowSuggestions() override { | |
1718 ASSERT_TRUE(content::ExecuteScript(inspected_contents_, | |
1719 "console.log('didShowSuggestions');")); | |
1720 } | |
1721 | |
1722 void OnTextFieldChanged() override {} | |
1723 | |
1724 private: | |
1725 WebContents* inspected_contents_; | |
1726 | |
1727 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTestDelegateDevtoolsImpl); | |
1728 }; | |
1729 | |
1730 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventShowsAutoFill) { | |
1731 OpenDevToolsWindow(kDispatchKeyEventShowsAutoFill, false); | |
1732 | |
1733 autofill::ContentAutofillDriver* autofill_driver = | |
1734 autofill::ContentAutofillDriverFactory::FromWebContents(GetInspectedTab()) | |
1735 ->DriverForFrame(GetInspectedTab()->GetMainFrame()); | |
1736 autofill::AutofillManager* autofill_manager = | |
1737 autofill_driver->autofill_manager(); | |
1738 AutofillManagerTestDelegateDevtoolsImpl autoFillTestDelegate( | |
1739 GetInspectedTab()); | |
1740 autofill_manager->SetTestDelegate(&autoFillTestDelegate); | |
1741 | |
1742 RunTestFunction(window_, "testDispatchKeyEventShowsAutoFill"); | |
1743 CloseDevToolsWindow(); | |
1744 } | |
1745 | |
1746 // Tests that settings are stored in profile correctly. | 1699 // Tests that settings are stored in profile correctly. |
1747 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) { | 1700 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) { |
1748 OpenDevToolsWindow("about:blank", true); | 1701 OpenDevToolsWindow("about:blank", true); |
1749 RunTestFunction(window_, "testSettings"); | 1702 RunTestFunction(window_, "testSettings"); |
1750 CloseDevToolsWindow(); | 1703 CloseDevToolsWindow(); |
1751 } | 1704 } |
1752 | 1705 |
1753 // Tests that external navigation from inspector page is always handled by | 1706 // Tests that external navigation from inspector page is always handled by |
1754 // DevToolsWindow and results in inspected page navigation. | 1707 // DevToolsWindow and results in inspected page navigation. |
1755 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { | 1708 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 RunTestFunction(window, "testWindowInitializedOnNavigateBack"); | 2069 RunTestFunction(window, "testWindowInitializedOnNavigateBack"); |
2117 | 2070 |
2118 DevToolsWindowTesting::CloseDevToolsWindowSync(window); | 2071 DevToolsWindowTesting::CloseDevToolsWindowSync(window); |
2119 content::WebUIControllerFactory::UnregisterFactoryForTesting(&test_factory); | 2072 content::WebUIControllerFactory::UnregisterFactoryForTesting(&test_factory); |
2120 } | 2073 } |
2121 | 2074 |
2122 // Tests scripts panel showing. | 2075 // Tests scripts panel showing. |
2123 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsSharedWorker) { | 2076 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsSharedWorker) { |
2124 RunTest("testDevToolsSharedWorker", url::kAboutBlankURL); | 2077 RunTest("testDevToolsSharedWorker", url::kAboutBlankURL); |
2125 } | 2078 } |
OLD | NEW |