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

Unified 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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_sanity_browsertest.cc
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc
index fb8514f174b95a9420458498ad02ea291f3e3b83..56cecaaee7b1fe641cebff52fb9d7ee881b78b46 100644
--- a/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -50,6 +50,10 @@
#include "chrome/test/base/ui_test_utils.h"
#include "components/app_modal/javascript_app_modal_dialog.h"
#include "components/app_modal/native_app_modal_dialog.h"
+#include "components/autofill/content/browser/content_autofill_driver.h"
+#include "components/autofill/content/browser/content_autofill_driver_factory.h"
+#include "components/autofill/core/browser/autofill_manager.h"
+#include "components/autofill/core/browser/autofill_manager_test_delegate.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/content_browser_client.h"
@@ -129,6 +133,8 @@ const char kReloadSharedWorkerTestWorker[] =
"files/workers/debug_shared_worker_initialization.js";
const char kEmulateNetworkConditionsPage[] =
"files/devtools/emulate_network_conditions.html";
+const char kDispatchKeyEventShowsAutoFill[] =
+ "files/devtools/dispatch_key_event_shows_auto_fill.html";
template <typename... T>
void DispatchOnTestSuiteSkipCheck(DevToolsWindow* window,
@@ -1696,6 +1702,47 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventDoesNotCrash) {
RunTest("testDispatchKeyEventDoesNotCrash", "about:blank");
}
+class AutofillManagerTestDelegateDevtoolsImpl
+ : public autofill::AutofillManagerTestDelegate {
+ public:
+ explicit AutofillManagerTestDelegateDevtoolsImpl(
+ WebContents* inspectedContents)
+ : inspected_contents_(inspectedContents) {}
+ ~AutofillManagerTestDelegateDevtoolsImpl() override {}
+
+ void DidPreviewFormData() override {}
+
+ void DidFillFormData() override {}
+
+ void DidShowSuggestions() override {
+ ASSERT_TRUE(content::ExecuteScript(inspected_contents_,
+ "console.log('didShowSuggestions');"));
+ }
+
+ void OnTextFieldChanged() override {}
+
+ private:
+ WebContents* inspected_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutofillManagerTestDelegateDevtoolsImpl);
+};
+
+IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDispatchKeyEventShowsAutoFill) {
+ OpenDevToolsWindow(kDispatchKeyEventShowsAutoFill, false);
+
+ autofill::ContentAutofillDriver* autofill_driver =
+ autofill::ContentAutofillDriverFactory::FromWebContents(GetInspectedTab())
+ ->DriverForFrame(GetInspectedTab()->GetMainFrame());
+ autofill::AutofillManager* autofill_manager =
+ autofill_driver->autofill_manager();
+ AutofillManagerTestDelegateDevtoolsImpl autoFillTestDelegate(
+ GetInspectedTab());
+ autofill_manager->SetTestDelegate(&autoFillTestDelegate);
+
+ RunTestFunction(window_, "testDispatchKeyEventShowsAutoFill");
+ CloseDevToolsWindow();
+}
+
// Tests that settings are stored in profile correctly.
IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) {
OpenDevToolsWindow("about:blank", true);
« 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
This is Rietveld 408576698