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

Side by Side Diff: chrome/browser/ui/autofill/password_generation_popup_view_browsertest.cc

Issue 811563004: [Password Generation] Hide popup if view can not be created. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Leak Created 6 years 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/autofill/password_generation_popup_controller_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/autofill/password_generation_popup_view.h" 5 #include "chrome/browser/ui/autofill/password_generation_popup_view.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " 8 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h "
9 #include "chrome/browser/ui/autofill/password_generation_popup_view_tester.h" 9 #include "chrome/browser/ui/autofill/password_generation_popup_view_tester.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 22 matching lines...) Expand all
33 33
34 ~TestPasswordGenerationPopupController() override {} 34 ~TestPasswordGenerationPopupController() override {}
35 35
36 PasswordGenerationPopupView* view() { 36 PasswordGenerationPopupView* view() {
37 return view_; 37 return view_;
38 } 38 }
39 }; 39 };
40 40
41 class PasswordGenerationPopupViewTest : public InProcessBrowserTest { 41 class PasswordGenerationPopupViewTest : public InProcessBrowserTest {
42 public: 42 public:
43 void SetUpOnMainThread() override { 43 content::WebContents* GetWebContents() {
44 gfx::NativeView native_view = 44 return browser()->tab_strip_model()->GetActiveWebContents();
45 browser()->tab_strip_model()->GetActiveWebContents()->GetNativeView(); 45 }
46 46
47 controller_ = 47 gfx::NativeView GetNativeView() {
48 new TestPasswordGenerationPopupController( 48 return GetWebContents()->GetNativeView();
49 browser()->tab_strip_model()->GetActiveWebContents(), native_view);
50 } 49 }
51 50
52 scoped_ptr<PasswordGenerationPopupViewTester> GetViewTester() { 51 scoped_ptr<PasswordGenerationPopupViewTester> GetViewTester() {
53 return PasswordGenerationPopupViewTester::For(controller_->view()).Pass(); 52 return PasswordGenerationPopupViewTester::For(controller_->view()).Pass();
54 } 53 }
55 54
56 protected: 55 protected:
57 TestPasswordGenerationPopupController* controller_; 56 TestPasswordGenerationPopupController* controller_;
58 }; 57 };
59 58
60 // TODO(gcasto): Enable on Mac when UI is updated. (crbug.com/394303) 59 // TODO(gcasto): Enable on Mac when UI is updated. (crbug.com/394303)
61 #if !defined(OS_MACOSX) 60 #if !defined(OS_MACOSX)
62 // Regression test for crbug.com/400543. Verifying that moving the mouse in the 61 // Regression test for crbug.com/400543. Verifying that moving the mouse in the
63 // editing dialog doesn't crash. 62 // editing dialog doesn't crash.
64 IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewTest, 63 IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewTest,
65 MouseMovementInEditingPopup) { 64 MouseMovementInEditingPopup) {
65 controller_ = new autofill::TestPasswordGenerationPopupController(
66 GetWebContents(), GetNativeView());
66 controller_->Show(false /* display_password */); 67 controller_->Show(false /* display_password */);
67 68
68 gfx::Point center_point = 69 gfx::Point center_point =
69 static_cast<PasswordGenerationPopupController*>( 70 static_cast<PasswordGenerationPopupController*>(
70 controller_)->popup_bounds().CenterPoint(); 71 controller_)->popup_bounds().CenterPoint();
71 GetViewTester()->SimulateMouseMovementAt(center_point); 72 GetViewTester()->SimulateMouseMovementAt(center_point);
72 73
73 // Deletes |controller_|. 74 // Deletes |controller_|.
74 controller_->HideAndDestroy(); 75 controller_->HideAndDestroy();
75 } 76 }
77
78 // Verify that we calling Show() with an invalid container does not crash.
79 // Regression test for crbug.com/439618.
80 IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewTest,
81 InvalidContainerView) {
82 controller_ = new autofill::TestPasswordGenerationPopupController(
83 GetWebContents(), NULL);
84 controller_->Show(true /* display password */);
85 }
76 #endif 86 #endif
77 87
78 } // namespace autofill 88 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/password_generation_popup_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698