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

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

Issue 2202373002: Ignore OnBubbleHidden() event when the password bubble is reopened. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete proxy Created 4 years, 4 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/base_passwords_controller_test.mm
diff --git a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm
index 8e1868f82094e316a005194b4c2231592a1aee37..582f508e9ddcdca2cf7c86ec256b038d57fda61f 100644
--- a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm
+++ b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm
@@ -6,9 +6,9 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/password_manager/password_store_factory.h"
-#include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
#include "components/password_manager/core/browser/mock_password_store.h"
#include "components/password_manager/core/browser/password_manager_test_utils.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/test/web_contents_tester.h"
namespace {
@@ -28,12 +28,12 @@ ManagePasswordsControllerTest::
void ManagePasswordsControllerTest::SetUp() {
CocoaProfileTest::SetUp();
- // Create the test UIController here so that it's bound to and owned by
- // |test_web_contents_| and therefore accessible to the model.
+
test_web_contents_.reset(
- content::WebContentsTester::CreateTestWebContents(profile(), NULL));
- ui_controller_ = new testing::NiceMock<ManagePasswordsUIControllerMock>(
- test_web_contents_.get());
+ content::WebContentsTester::CreateTestWebContents(profile(), nullptr));
+ ui_controller_.reset(new testing::NiceMock<PasswordsModelDelegateMock>);
+ ON_CALL(*ui_controller_, GetWebContents())
+ .WillByDefault(Return(test_web_contents_.get()));
PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
profile(), password_manager::BuildPasswordStore<
content::BrowserContext,
@@ -44,7 +44,7 @@ void ManagePasswordsControllerTest::SetUp() {
ManagePasswordsBubbleModel*
ManagePasswordsControllerTest::GetModelAndCreateIfNull() {
if (!model_) {
- model_.reset(new ManagePasswordsBubbleModel(test_web_contents_.get(),
+ model_.reset(new ManagePasswordsBubbleModel(ui_controller_->AsWeakPtr(),
GetDisplayReason()));
[delegate() setModel:model_.get()];
}
@@ -64,7 +64,7 @@ void ManagePasswordsControllerTest::SetUpSavePendingState(bool empty_username) {
EXPECT_CALL(*ui_controller_, GetState())
.WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE));
GetModelAndCreateIfNull();
- ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_));
+ ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get()));
}
void ManagePasswordsControllerTest::SetUpUpdatePendingState(
@@ -82,7 +82,7 @@ void ManagePasswordsControllerTest::SetUpUpdatePendingState(
EXPECT_CALL(*ui_controller_, GetState())
.WillOnce(Return(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE));
GetModelAndCreateIfNull();
- ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_));
+ ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get()));
}
void ManagePasswordsControllerTest::SetUpConfirmationState() {
@@ -91,7 +91,7 @@ void ManagePasswordsControllerTest::SetUpConfirmationState() {
EXPECT_CALL(*ui_controller_, GetState())
.WillOnce(Return(password_manager::ui::CONFIRMATION_STATE));
GetModelAndCreateIfNull();
- ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_));
+ ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get()));
}
void ManagePasswordsControllerTest::SetUpManageState(
@@ -102,7 +102,7 @@ void ManagePasswordsControllerTest::SetUpManageState(
EXPECT_CALL(*ui_controller_, GetState())
.WillOnce(Return(password_manager::ui::MANAGE_STATE));
GetModelAndCreateIfNull();
- ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_));
+ ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get()));
}
ManagePasswordsBubbleModel::DisplayReason

Powered by Google App Engine
This is Rietveld 408576698