Index: chrome/browser/ui/autofill/password_generation_popup_view_browsertest.cc |
diff --git a/chrome/browser/ui/autofill/password_generation_popup_view_browsertest.cc b/chrome/browser/ui/autofill/password_generation_popup_view_browsertest.cc |
index 7789f67fcfab17563197da1cbb5c119a64070ada..55eab63bdf320010e80f44c669e3c9f2a3d2ab14 100644 |
--- a/chrome/browser/ui/autofill/password_generation_popup_view_browsertest.cc |
+++ b/chrome/browser/ui/autofill/password_generation_popup_view_browsertest.cc |
@@ -40,13 +40,12 @@ class TestPasswordGenerationPopupController : |
class PasswordGenerationPopupViewTest : public InProcessBrowserTest { |
public: |
- void SetUpOnMainThread() override { |
- gfx::NativeView native_view = |
- browser()->tab_strip_model()->GetActiveWebContents()->GetNativeView(); |
+ content::WebContents* GetWebContents() { |
+ return browser()->tab_strip_model()->GetActiveWebContents(); |
+ } |
- controller_ = |
- new TestPasswordGenerationPopupController( |
- browser()->tab_strip_model()->GetActiveWebContents(), native_view); |
+ gfx::NativeView GetNativeView() { |
+ return GetWebContents()->GetNativeView(); |
} |
scoped_ptr<PasswordGenerationPopupViewTester> GetViewTester() { |
@@ -63,6 +62,8 @@ class PasswordGenerationPopupViewTest : public InProcessBrowserTest { |
// editing dialog doesn't crash. |
IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewTest, |
MouseMovementInEditingPopup) { |
+ controller_ = new autofill::TestPasswordGenerationPopupController( |
+ GetWebContents(), GetNativeView()); |
controller_->Show(false /* display_password */); |
gfx::Point center_point = |
@@ -73,6 +74,15 @@ IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewTest, |
// Deletes |controller_|. |
controller_->HideAndDestroy(); |
} |
+ |
+// Verify that we calling Show() with an invalid container does not crash. |
+// Regression test for crbug.com/439618. |
+IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewTest, |
+ InvalidContainerView) { |
+ controller_ = new autofill::TestPasswordGenerationPopupController( |
+ GetWebContents(), NULL); |
+ controller_->Show(true /* display password */); |
+} |
#endif |
} // namespace autofill |