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

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

Issue 1515553006: Change password bubble for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tiny comment update Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/passwords/update_pending_password_view_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/passwords/update_pending_password_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/update_pending_password_view_controller_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ac3df4c327adbe61e37d36dd39a0bd7a009dc514
--- /dev/null
+++ b/chrome/browser/ui/cocoa/passwords/update_pending_password_view_controller_unittest.mm
@@ -0,0 +1,95 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/ui/cocoa/passwords/pending_password_view_controller.h"
+
+#include "base/mac/scoped_nsobject.h"
+#include "base/strings/string16.h"
+#include "base/strings/utf_string_conversions.h"
+#import "chrome/browser/ui/cocoa/bubble_combobox.h"
+#include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
+#include "chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h"
+#import "chrome/browser/ui/cocoa/passwords/passwords_list_view_controller.h"
+#import "chrome/browser/ui/cocoa/passwords/credentials_selection_view.h"
+#import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controller.h"
+#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
+#include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+
+using testing::_;
+
+namespace {
+
+class UpdatePendingPasswordViewControllerTest
+ : public ManagePasswordsControllerTest {
+ public:
+ UpdatePendingPasswordViewControllerTest() {}
+
+ void SetUp() override {
+ ManagePasswordsControllerTest::SetUp();
+ delegate_.reset([[ContentViewDelegateMock alloc] init]);
+ }
+
+ ContentViewDelegateMock* delegate() { return delegate_.get(); }
+
+ UpdatePendingPasswordViewController* controller() {
+ if (!controller_) {
+ controller_.reset([[UpdatePendingPasswordViewController alloc]
+ initWithModel:GetModelAndCreateIfNull()
+ delegate:delegate()]);
+ [controller_ loadView];
+ }
+ return controller_.get();
+ }
+
+ private:
+ base::scoped_nsobject<UpdatePendingPasswordViewController> controller_;
+ base::scoped_nsobject<ContentViewDelegateMock> delegate_;
+};
+
+TEST_F(UpdatePendingPasswordViewControllerTest,
+ ShouldUpdatePasswordAndDismissWhenUpdateClicked) {
+ SetUpUpdatePendingState(false);
+ EXPECT_CALL(*ui_controller(), UpdatePassword(_));
+ EXPECT_CALL(*ui_controller(), OnNopeUpdateClicked()).Times(0);
+ [controller().updateButton performClick:nil];
+
+ EXPECT_TRUE([delegate() dismissed]);
+}
+
+TEST_F(UpdatePendingPasswordViewControllerTest,
+ ShouldNopeAndDismissWhenNopeClicked) {
+ SetUpUpdatePendingState(false);
+ EXPECT_CALL(*ui_controller(), UpdatePassword(_)).Times(0);
+ EXPECT_CALL(*ui_controller(), OnNopeUpdateClicked());
+ [controller().noButton performClick:nil];
+
+ EXPECT_TRUE([delegate() dismissed]);
+}
+
+TEST_F(UpdatePendingPasswordViewControllerTest, ShouldDismissWhenCrossClicked) {
+ SetUpUpdatePendingState(false);
+ EXPECT_CALL(*ui_controller(), UpdatePassword(_)).Times(0);
+ EXPECT_CALL(*ui_controller(), OnNopeUpdateClicked()).Times(0);
+ [controller().closeButton performClick:nil];
+
+ EXPECT_TRUE([delegate() dismissed]);
+}
+
+TEST_F(UpdatePendingPasswordViewControllerTest,
+ ShouldShowUsernameLabelWhenOneCredentials) {
+ SetUpUpdatePendingState(false);
+ EXPECT_NE([CredentialsSelectionView class],
+ [[controller() createPasswordView] class]);
+}
+
+TEST_F(UpdatePendingPasswordViewControllerTest,
+ ShouldShowUsernamesComboboxWhenMultipleCredentials) {
+ SetUpUpdatePendingState(true);
+ EXPECT_EQ([CredentialsSelectionView class],
+ [[controller() createPasswordView] class]);
+}
+
+} // namespace
« no previous file with comments | « chrome/browser/ui/cocoa/passwords/update_pending_password_view_controller.mm ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698