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

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

Issue 2040143006: Implement the Sync promo in the password bubble on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 6 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/manage_passwords_view_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm
index eb4b3fb6f585fed36876efea0c5dbf2b2c7846f9..2aa5d6b5dd09732a8192386a63736074921ed19d 100644
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm
@@ -24,22 +24,15 @@ namespace {
class ManagePasswordsViewControllerTest : public ManagePasswordsControllerTest {
public:
- ManagePasswordsViewControllerTest() : controller_(nil) {}
-
- void SetUp() override {
- ManagePasswordsControllerTest::SetUp();
- delegate_.reset([[ContentViewDelegateMock alloc] init]);
+ void SetUpManageState(
+ const VectorConstFormPtr& forms = VectorConstFormPtr()) {
+ ManagePasswordsControllerTest::SetUpManageState(forms);
+ controller_.reset(
+ [[ManagePasswordsViewController alloc] initWithDelegate:delegate()]);
+ [controller_ view];
}
- ContentViewDelegateMock* delegate() { return delegate_.get(); }
-
ManagePasswordsViewController* controller() {
- if (!controller_) {
- [delegate() setModel:GetModelAndCreateIfNull()];
- controller_.reset(
- [[ManagePasswordsViewController alloc] initWithDelegate:delegate()]);
- [controller_ view];
- }
return controller_.get();
}
@@ -49,8 +42,6 @@ class ManagePasswordsViewControllerTest : public ManagePasswordsControllerTest {
private:
base::scoped_nsobject<ManagePasswordsViewController> controller_;
- base::scoped_nsobject<ContentViewDelegateMock> delegate_;
- DISALLOW_COPY_AND_ASSIGN(ManagePasswordsViewControllerTest);
};
TEST_F(ManagePasswordsViewControllerTest, ShouldDismissWhenDoneClicked) {
@@ -86,18 +77,9 @@ TEST_F(ManagePasswordsViewControllerTest,
form2.username_value = base::ASCIIToUTF16("username2");
form2.password_value = base::ASCIIToUTF16("password2");
- // Add the entries to the model.
- std::vector<const autofill::PasswordForm*> forms;
- forms.push_back(&form1);
- forms.push_back(&form2);
- EXPECT_CALL(*ui_controller(), GetCurrentForms()).WillOnce(ReturnRef(forms));
- GURL origin;
- EXPECT_CALL(*ui_controller(), GetOrigin()).WillOnce(ReturnRef(origin));
- EXPECT_CALL(*ui_controller(), GetState())
- .WillOnce(Return(password_manager::ui::MANAGE_STATE));
+ SetUpManageState({&form1, &form2});
vabr (Chromium) 2016/06/10 13:54:59 I like the brevity of the initializer list!
vasilii 2016/06/10 14:35:13 +1
// Check the view state.
- EXPECT_FALSE(GetModelAndCreateIfNull()->local_credentials().empty());
ASSERT_TRUE([controller() passwordsListController]);
EXPECT_FALSE([controller() noPasswordsView]);
NSArray* items = [[controller() passwordsListController] itemViews];
@@ -124,7 +106,6 @@ TEST_F(ManagePasswordsViewControllerTest, CloseBubbleAndHandleClick) {
SetUpManageState();
EXPECT_CALL(*ui_controller(), NavigateToPasswordManagerSettingsPage())
.Times(0);
- [controller() bubbleWillDisappear];
[delegate() setModel:nil];
[controller().doneButton performClick:nil];
[controller().manageButton performClick:nil];

Powered by Google App Engine
This is Rietveld 408576698