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

Unified Diff: chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm

Issue 1645503002: Remove dangling ManagePasswordsBubbleModel pointers. Test that different password bubbles don't pin… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm
index 6aa599068a3bd436c5ccc341b7381bd766e83c8a..e8c903a84bc9d9daf94e26d0d4e050883dfb221f 100644
--- a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm
@@ -17,10 +17,10 @@
namespace {
-class ManagePasswordsBubbleConfirmationViewControllerTest
+class ConfirmationPasswordSavedViewControllerTest
: public ManagePasswordsControllerTest {
public:
- ManagePasswordsBubbleConfirmationViewControllerTest() : controller_(nil) {}
+ ConfirmationPasswordSavedViewControllerTest() : controller_(nil) {}
void SetUp() override {
ManagePasswordsControllerTest::SetUp();
@@ -30,33 +30,43 @@ class ManagePasswordsBubbleConfirmationViewControllerTest
ContentViewDelegateMock* delegate() { return delegate_.get(); }
- ManagePasswordsBubbleConfirmationViewController* controller() {
+ ConfirmationPasswordSavedViewController* controller() {
if (!controller_) {
- controller_.reset([[ManagePasswordsBubbleConfirmationViewController alloc]
- initWithModel:GetModelAndCreateIfNull()
- delegate:delegate()]);
- [controller_ loadView];
+ [delegate() setModel:GetModelAndCreateIfNull()];
+ controller_.reset([[ConfirmationPasswordSavedViewController alloc]
+ initWithDelegate:delegate()]);
+ [controller_ view];
}
return controller_.get();
}
private:
- base::scoped_nsobject<ManagePasswordsBubbleConfirmationViewController>
- controller_;
+ base::scoped_nsobject<ConfirmationPasswordSavedViewController> controller_;
base::scoped_nsobject<ContentViewDelegateMock> delegate_;
};
-TEST_F(ManagePasswordsBubbleConfirmationViewControllerTest,
+TEST_F(ConfirmationPasswordSavedViewControllerTest,
ShouldDismissWhenOKClicked) {
[controller().okButton performClick:nil];
EXPECT_TRUE([delegate() dismissed]);
}
-TEST_F(ManagePasswordsBubbleConfirmationViewControllerTest,
+TEST_F(ConfirmationPasswordSavedViewControllerTest,
ShouldOpenPasswordsAndDismissWhenLinkClicked) {
EXPECT_CALL(*ui_controller(), NavigateToPasswordManagerSettingsPage());
[controller().confirmationText clickedOnLink:@"about:blank" atIndex:0];
EXPECT_TRUE([delegate() dismissed]);
}
+TEST_F(ConfirmationPasswordSavedViewControllerTest, CloseBubbleAndHandleClick) {
+ // A user may press mouse down, some navigation closes the bubble, mouse up
+ // still sends the action.
+ EXPECT_CALL(*ui_controller(), NavigateToPasswordManagerSettingsPage())
+ .Times(0);
+ [controller() bubbleWillDisappear];
+ [delegate() setModel:nil];
+ [controller().confirmationText clickedOnLink:@"about:blank" atIndex:0];
+ [controller().okButton performClick:nil];
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698