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

Unified Diff: chrome/browser/ui/passwords/password_manager_presenter_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/passwords/password_manager_presenter_unittest.cc
diff --git a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
index bc0fe2ba22e48ec6edc0e595773e2c8950aee2dd..d0855f8438665f6b46a1a8b918ee86689604c1c2 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
@@ -48,10 +48,12 @@ class MockPasswordUIView : public PasswordUIView {
#endif
MOCK_METHOD4(ShowPassword, void(
size_t, const std::string&, const std::string&, const base::string16&));
- MOCK_METHOD1(SetPasswordList,
- void(const std::vector<scoped_ptr<autofill::PasswordForm>>&));
- MOCK_METHOD1(SetPasswordExceptionList,
- void(const std::vector<scoped_ptr<autofill::PasswordForm>>&));
+ MOCK_METHOD1(
+ SetPasswordList,
+ void(const std::vector<std::unique_ptr<autofill::PasswordForm>>&));
+ MOCK_METHOD1(
+ SetPasswordExceptionList,
+ void(const std::vector<std::unique_ptr<autofill::PasswordForm>>&));
PasswordManagerPresenter* GetPasswordManagerPresenter() {
return &password_manager_presenter_;
}
@@ -93,7 +95,7 @@ class PasswordManagerPresenterTest : public testing::Test {
private:
content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
- scoped_ptr<MockPasswordUIView> mock_controller_;
+ std::unique_ptr<MockPasswordUIView> mock_controller_;
DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenterTest);
};
@@ -102,7 +104,7 @@ void PasswordManagerPresenterTest::AddPasswordEntry(
const GURL& origin,
const std::string& user_name,
const std::string& password) {
- scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm());
+ std::unique_ptr<autofill::PasswordForm> form(new autofill::PasswordForm());
form->origin = origin;
form->username_element = base::ASCIIToUTF16("Email");
form->username_value = base::ASCIIToUTF16(user_name);
@@ -113,7 +115,7 @@ void PasswordManagerPresenterTest::AddPasswordEntry(
}
void PasswordManagerPresenterTest::AddPasswordException(const GURL& origin) {
- scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm());
+ std::unique_ptr<autofill::PasswordForm> form(new autofill::PasswordForm());
form->origin = origin;
mock_controller_->GetPasswordManagerPresenter()
->password_exception_list_.push_back(std::move(form));
@@ -128,11 +130,11 @@ void PasswordManagerPresenterTest::SortAndCheckPositions(
const SortEntry test_entries[],
size_t number_of_entries,
bool username_and_password_in_key) {
- std::vector<scoped_ptr<autofill::PasswordForm>> list;
+ std::vector<std::unique_ptr<autofill::PasswordForm>> list;
size_t expected_number_of_unique_entries = 0;
for (size_t i = 0; i < number_of_entries; i++) {
const SortEntry& entry = test_entries[i];
- scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm());
+ std::unique_ptr<autofill::PasswordForm> form(new autofill::PasswordForm());
form->signon_realm = entry.origin;
form->origin = GURL(base::ASCIIToUTF16(entry.origin));
if (username_and_password_in_key) {
@@ -173,47 +175,47 @@ void PasswordManagerPresenterTest::SortAndCheckPositions(
namespace {
TEST_F(PasswordManagerPresenterTest, UIControllerIsCalled) {
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordExceptionList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(0u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordExceptionList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(0u))));
UpdateLists();
GURL pass_origin("http://abc1.com");
AddPasswordEntry(pass_origin, "test@gmail.com", "test");
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordExceptionList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(1u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordExceptionList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(0u))));
UpdateLists();
GURL except_origin("http://abc2.com");
AddPasswordException(except_origin);
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordExceptionList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(1u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordExceptionList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(1u))));
UpdateLists();
GURL pass_origin2("http://example.com");
AddPasswordEntry(pass_origin2, "test@gmail.com", "test");
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(2u))));
- EXPECT_CALL(
- *GetUIController(),
- SetPasswordExceptionList(Property(
- &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(2u))));
+ EXPECT_CALL(*GetUIController(),
+ SetPasswordExceptionList(Property(
+ &std::vector<std::unique_ptr<autofill::PasswordForm>>::size,
+ Eq(1u))));
UpdateLists();
}
« no previous file with comments | « chrome/browser/ui/passwords/password_manager_presenter.cc ('k') | chrome/browser/ui/passwords/password_ui_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698