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

Unified Diff: chrome/browser/chromeos/login/ui/simple_web_view_dialog_browsertest.cc

Issue 2727813006: Create ChromeAutofillClient in SimpleWebViewDialog
Patch Set: fixes Created 3 years, 10 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
Index: chrome/browser/chromeos/login/ui/simple_web_view_dialog_browsertest.cc
diff --git a/chrome/browser/chromeos/login/ui/simple_web_view_dialog_browsertest.cc b/chrome/browser/chromeos/login/ui/simple_web_view_dialog_browsertest.cc
index 63193cad55352b616d6554d4127f689a03c5be64..ea41a23867e0eefe3ef61a251f0629590cf795ea 100644
--- a/chrome/browser/chromeos/login/ui/simple_web_view_dialog_browsertest.cc
+++ b/chrome/browser/chromeos/login/ui/simple_web_view_dialog_browsertest.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/login/ui/simple_web_view_dialog.h"
#include "chrome/browser/chromeos/login/ui/webui_login_view.h"
+#include "components/password_manager/content/browser/content_password_manager_driver.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/interstitial_page_delegate.h"
#include "ui/views/controls/webview/webview.h"
@@ -54,11 +55,21 @@ class SimpleWebViewDialogTest : public LoginManagerTest {
~SimpleWebViewDialogTest() override {}
InterstitialPageDelegate* CreateDelegate(CaptivePortalWindowProxy* proxy) {
- SimpleWebViewDialog* dialog = proxy->captive_portal_view_for_testing();
+ SimpleWebViewDialog* dialog = GetSimpleWebViewDialog(proxy);
CHECK(dialog) << "CaptivePortalView is not initialized";
return new InterstitialPageDelegate(dialog->web_view_->web_contents());
}
+ protected:
+ SimpleWebViewDialog* GetSimpleWebViewDialog(CaptivePortalWindowProxy* proxy) {
meacer 2017/03/04 05:54:14 const method
+ return proxy->captive_portal_view_for_testing();
+ }
+
+ content::WebContents* GetSimpleWebViewDialogWebContents(
+ SimpleWebViewDialog* dialog) {
meacer 2017/03/04 05:54:14 const method
+ return dialog->web_view_->GetWebContents();
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialogTest);
};
@@ -75,4 +86,23 @@ IN_PROC_BROWSER_TEST_F(SimpleWebViewDialogTest, Interstitial) {
CreateDelegate(&proxy);
}
+// Regression test for https://crbug.com/698438
+IN_PROC_BROWSER_TEST_F(SimpleWebViewDialogTest, AutofillClientGetsCreated) {
+ content::WebContents* web_contents =
+ LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents();
+ StubDelegate delegate;
+ CaptivePortalWindowProxy proxy(&delegate, web_contents);
+ proxy.Show();
+ SimpleWebViewDialog* dialog = GetSimpleWebViewDialog(&proxy);
+
+ dialog->StartLoad(GURL("http://example.test"));
+ password_manager::ContentPasswordManagerDriver* driver =
+ password_manager::ContentPasswordManagerDriver::GetForRenderFrameHost(
+ GetSimpleWebViewDialogWebContents(dialog)->GetMainFrame());
+ ASSERT_TRUE(driver);
+ // This call would crash if a ChromeAutofillManager hadn't been created
+ // properly.
+ driver->ShowNotSecureWarning(base::i18n::LEFT_TO_RIGHT, gfx::RectF(0, 0));
meacer 2017/03/04 05:54:14 Would it make sense to change this test or add a n
+}
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698