Chromium Code Reviews

Side by Side Diff: chrome/browser/devtools/devtools_sanity_browsertest.cc

Issue 2656903005: ChromeDriver: Handle key events properly on Mac (Closed)
Patch Set: fixes Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | chrome/test/data/devtools/dispatch_key_event_shows_auto_fill.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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...)
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"
53 #include "components/prefs/pref_service.h" 57 #include "components/prefs/pref_service.h"
54 #include "content/public/browser/child_process_data.h" 58 #include "content/public/browser/child_process_data.h"
55 #include "content/public/browser/content_browser_client.h" 59 #include "content/public/browser/content_browser_client.h"
56 #include "content/public/browser/devtools_agent_host.h" 60 #include "content/public/browser/devtools_agent_host.h"
57 #include "content/public/browser/notification_registrar.h" 61 #include "content/public/browser/notification_registrar.h"
58 #include "content/public/browser/notification_service.h" 62 #include "content/public/browser/notification_service.h"
59 #include "content/public/browser/render_frame_host.h" 63 #include "content/public/browser/render_frame_host.h"
60 #include "content/public/browser/render_view_host.h" 64 #include "content/public/browser/render_view_host.h"
61 #include "content/public/browser/render_widget_host.h" 65 #include "content/public/browser/render_widget_host.h"
62 #include "content/public/browser/render_widget_host_view.h" 66 #include "content/public/browser/render_widget_host_view.h"
(...skipping 59 matching lines...)
122 const char kSharedWorkerTestPage[] = 126 const char kSharedWorkerTestPage[] =
123 "files/workers/workers_ui_shared_worker.html"; 127 "files/workers/workers_ui_shared_worker.html";
124 const char kSharedWorkerTestWorker[] = 128 const char kSharedWorkerTestWorker[] =
125 "files/workers/workers_ui_shared_worker.js"; 129 "files/workers/workers_ui_shared_worker.js";
126 const char kReloadSharedWorkerTestPage[] = 130 const char kReloadSharedWorkerTestPage[] =
127 "files/workers/debug_shared_worker_initialization.html"; 131 "files/workers/debug_shared_worker_initialization.html";
128 const char kReloadSharedWorkerTestWorker[] = 132 const char kReloadSharedWorkerTestWorker[] =
129 "files/workers/debug_shared_worker_initialization.js"; 133 "files/workers/debug_shared_worker_initialization.js";
130 const char kEmulateNetworkConditionsPage[] = 134 const char kEmulateNetworkConditionsPage[] =
131 "files/devtools/emulate_network_conditions.html"; 135 "files/devtools/emulate_network_conditions.html";
136 const char kDispatchKeyEventShowsAutoFill[] =
137 "files/devtools/dispatch_key_event_shows_auto_fill.html";
132 138
133 template <typename... T> 139 template <typename... T>
134 void DispatchOnTestSuiteSkipCheck(DevToolsWindow* window, 140 void DispatchOnTestSuiteSkipCheck(DevToolsWindow* window,
135 const char* method, 141 const char* method,
136 T... args) { 142 T... args) {
137 RenderViewHost* rvh = DevToolsWindowTesting::Get(window) 143 RenderViewHost* rvh = DevToolsWindowTesting::Get(window)
138 ->main_web_contents() 144 ->main_web_contents()
139 ->GetRenderViewHost(); 145 ->GetRenderViewHost();
140 std::string result; 146 std::string result;
141 const char* args_array[] = {method, args...}; 147 const char* args_array[] = {method, args...};
(...skipping 1547 matching lines...)
1689 } 1695 }
1690 1696
1691 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDeviceEmulation) { 1697 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDeviceEmulation) {
1692 RunTest("testDeviceMetricsOverrides", "about:blank"); 1698 RunTest("testDeviceMetricsOverrides", "about:blank");
1693 } 1699 }
1694 1700
1695 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventDoesNotCrash) { 1701 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventDoesNotCrash) {
1696 RunTest("testDispatchKeyEventDoesNotCrash", "about:blank"); 1702 RunTest("testDispatchKeyEventDoesNotCrash", "about:blank");
1697 } 1703 }
1698 1704
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
1699 // Tests that settings are stored in profile correctly. 1746 // Tests that settings are stored in profile correctly.
1700 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) { 1747 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) {
1701 OpenDevToolsWindow("about:blank", true); 1748 OpenDevToolsWindow("about:blank", true);
1702 RunTestFunction(window_, "testSettings"); 1749 RunTestFunction(window_, "testSettings");
1703 CloseDevToolsWindow(); 1750 CloseDevToolsWindow();
1704 } 1751 }
1705 1752
1706 // Tests that external navigation from inspector page is always handled by 1753 // Tests that external navigation from inspector page is always handled by
1707 // DevToolsWindow and results in inspected page navigation. 1754 // DevToolsWindow and results in inspected page navigation.
1708 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { 1755 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) {
(...skipping 360 matching lines...)
2069 RunTestFunction(window, "testWindowInitializedOnNavigateBack"); 2116 RunTestFunction(window, "testWindowInitializedOnNavigateBack");
2070 2117
2071 DevToolsWindowTesting::CloseDevToolsWindowSync(window); 2118 DevToolsWindowTesting::CloseDevToolsWindowSync(window);
2072 content::WebUIControllerFactory::UnregisterFactoryForTesting(&test_factory); 2119 content::WebUIControllerFactory::UnregisterFactoryForTesting(&test_factory);
2073 } 2120 }
2074 2121
2075 // Tests scripts panel showing. 2122 // Tests scripts panel showing.
2076 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsSharedWorker) { 2123 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsSharedWorker) {
2077 RunTest("testDevToolsSharedWorker", url::kAboutBlankURL); 2124 RunTest("testDevToolsSharedWorker", url::kAboutBlankURL);
2078 } 2125 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/devtools/dispatch_key_event_shows_auto_fill.html » ('j') | no next file with comments »

Powered by Google App Engine