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

Unified Diff: chrome/browser/password_manager/password_store_mac_unittest.cc

Issue 1858513002: chrome/browser/password_manager: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows -- revert unwanted change Created 4 years, 9 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/password_manager/password_store_mac_unittest.cc
diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc
index 39c21c0b2381db9ede54f209923b00a8e345ec5b..48032af74f00d7c06668d9a1234101ababd1a394 100644
--- a/chrome/browser/password_manager/password_store_mac_unittest.cc
+++ b/chrome/browser/password_manager/password_store_mac_unittest.cc
@@ -10,6 +10,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/scoped_observer.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
@@ -191,7 +192,7 @@ class PasswordStoreMacTestDelegate {
base::MessageLoopForUI message_loop_;
base::ScopedTempDir db_dir_;
- scoped_ptr<LoginDatabase> login_db_;
+ std::unique_ptr<LoginDatabase> login_db_;
scoped_refptr<PasswordStoreMac> store_;
DISALLOW_COPY_AND_ASSIGN(PasswordStoreMacTestDelegate);
@@ -221,7 +222,7 @@ void PasswordStoreMacTestDelegate::Initialize() {
// Create and initialize the password store.
store_ = new PasswordStoreMac(base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get(),
- make_scoped_ptr(new MockAppleKeychain));
+ base::WrapUnique(new MockAppleKeychain));
store_->set_login_metadata_db(login_db_.get());
store_->login_metadata_db()->set_clear_password_values(false);
}
@@ -568,7 +569,7 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainSearch) {
MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_);
owned_keychain_adapter.SetFindsOnlyOwnedItems(true);
for (unsigned int i = 0; i < arraysize(test_data); ++i) {
- scoped_ptr<PasswordForm> query_form =
+ std::unique_ptr<PasswordForm> query_form =
CreatePasswordFormFromDataForTesting(test_data[i].data);
// Check matches treating the form as a fill target.
@@ -647,7 +648,7 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainExactSearch) {
for (unsigned int i = 0; i < arraysize(base_form_data); ++i) {
// Create a base form and make sure we find a match.
- scoped_ptr<PasswordForm> base_form =
+ std::unique_ptr<PasswordForm> base_form =
CreatePasswordFormFromDataForTesting(base_form_data[i]);
EXPECT_TRUE(keychain_adapter.HasPasswordsMergeableWithForm(*base_form));
EXPECT_TRUE(keychain_adapter.HasPasswordExactlyMatchingForm(*base_form));
@@ -731,7 +732,7 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainAdd) {
owned_keychain_adapter.SetFindsOnlyOwnedItems(true);
for (unsigned int i = 0; i < arraysize(test_data); ++i) {
- scoped_ptr<PasswordForm> in_form =
+ std::unique_ptr<PasswordForm> in_form =
CreatePasswordFormFromDataForTesting(test_data[i].data);
bool add_succeeded = owned_keychain_adapter.AddPassword(*in_form);
EXPECT_EQ(test_data[i].should_succeed, add_succeeded);
@@ -752,7 +753,7 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainAdd) {
"http://some.domain.com/insecure.html", NULL,
NULL, NULL, NULL, L"joe_user", L"updated_password", false, false, 0
};
- scoped_ptr<PasswordForm> update_form =
+ std::unique_ptr<PasswordForm> update_form =
CreatePasswordFormFromDataForTesting(data);
MacKeychainPasswordFormAdapter keychain_adapter(keychain_);
EXPECT_TRUE(keychain_adapter.AddPassword(*update_form));
@@ -797,13 +798,13 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainRemove) {
// Add our test items (except the last one) so that we can delete them.
for (unsigned int i = 0; i + 1 < arraysize(test_data); ++i) {
- scoped_ptr<PasswordForm> add_form =
+ std::unique_ptr<PasswordForm> add_form =
CreatePasswordFormFromDataForTesting(test_data[i].data);
EXPECT_TRUE(owned_keychain_adapter.AddPassword(*add_form));
}
for (unsigned int i = 0; i < arraysize(test_data); ++i) {
- scoped_ptr<PasswordForm> form =
+ std::unique_ptr<PasswordForm> form =
CreatePasswordFormFromDataForTesting(test_data[i].data);
EXPECT_EQ(test_data[i].should_succeed,
owned_keychain_adapter.RemovePassword(*form));
@@ -1227,7 +1228,7 @@ TEST_F(PasswordStoreMacInternalsTest, TestPasswordGetAll) {
L"testname", L"testpass", false, false, 0 },
};
for (unsigned int i = 0; i < arraysize(owned_password_data); ++i) {
- scoped_ptr<PasswordForm> form =
+ std::unique_ptr<PasswordForm> form =
CreatePasswordFormFromDataForTesting(owned_password_data[i]);
owned_keychain_adapter.AddPassword(*form);
}
@@ -1287,7 +1288,7 @@ class PasswordStoreMacTest : public testing::Test {
void CreateAndInitPasswordStore(password_manager::LoginDatabase* login_db) {
store_ = new PasswordStoreMac(
base::ThreadTaskRunnerHandle::Get(), nullptr,
- make_scoped_ptr<AppleKeychain>(new MockAppleKeychain));
+ base::WrapUnique<AppleKeychain>(new MockAppleKeychain));
ASSERT_TRUE(thread_->task_runner()->PostTask(
FROM_HERE, base::Bind(&PasswordStoreMac::InitWithTaskRunner, store_,
thread_->task_runner())));
@@ -1380,12 +1381,12 @@ class PasswordStoreMacTest : public testing::Test {
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
// Thread that the synchronous methods are run on.
- scoped_ptr<base::Thread> thread_;
+ std::unique_ptr<base::Thread> thread_;
base::ScopedTempDir db_dir_;
- scoped_ptr<password_manager::LoginDatabase> login_db_;
+ std::unique_ptr<password_manager::LoginDatabase> login_db_;
scoped_refptr<PasswordStoreMac> store_;
- scoped_ptr<base::HistogramTester> histogram_tester_;
+ std::unique_ptr<base::HistogramTester> histogram_tester_;
};
TEST_F(PasswordStoreMacTest, TestStoreUpdate) {
@@ -1399,7 +1400,7 @@ TEST_F(PasswordStoreMacTest, TestStoreUpdate) {
"http://some.domain.com/insecure.html", "login.cgi",
L"username", L"password", L"submit", L"joe_user", L"sekrit", true, false, 1
};
- scoped_ptr<PasswordForm> joint_form =
+ std::unique_ptr<PasswordForm> joint_form =
CreatePasswordFormFromDataForTesting(joint_data);
EXPECT_EQ(AddChangeForForm(*joint_form), login_db()->AddLogin(*joint_form));
MockAppleKeychain::KeychainTestData joint_keychain_data = {
@@ -1449,7 +1450,7 @@ TEST_F(PasswordStoreMacTest, TestStoreUpdate) {
},
};
for (unsigned int i = 0; i < arraysize(updates); ++i) {
- scoped_ptr<PasswordForm> form =
+ std::unique_ptr<PasswordForm> form =
CreatePasswordFormFromDataForTesting(updates[i].form_data);
store_->UpdateLogin(*form);
}
@@ -1458,7 +1459,7 @@ TEST_F(PasswordStoreMacTest, TestStoreUpdate) {
MacKeychainPasswordFormAdapter keychain_adapter(keychain());
for (unsigned int i = 0; i < arraysize(updates); ++i) {
- scoped_ptr<PasswordForm> query_form =
+ std::unique_ptr<PasswordForm> query_form =
CreatePasswordFormFromDataForTesting(updates[i].form_data);
ScopedVector<autofill::PasswordForm> matching_items =
@@ -1501,7 +1502,7 @@ TEST_F(PasswordStoreMacTest, TestDBKeychainAssociation) {
"http://www.facebook.com/index.html", "login",
L"username", L"password", L"submit", L"joe_user", L"sekrit", true, false, 1
};
- scoped_ptr<PasswordForm> www_form =
+ std::unique_ptr<PasswordForm> www_form =
CreatePasswordFormFromDataForTesting(www_form_data);
EXPECT_EQ(AddChangeForForm(*www_form), login_db()->AddLogin(*www_form));
MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain());
@@ -1594,11 +1595,11 @@ void CheckRemoveLoginsBetween(PasswordStoreMacTest* test, bool check_created) {
PasswordForm::SCHEME_HTML, "http://different.com/",
"http://different.com/index.html", "login", L"submit", L"username",
L"password", L"different_joe_user", L"sekrit", true, false, 0 };
- scoped_ptr<PasswordForm> form_facebook =
+ std::unique_ptr<PasswordForm> form_facebook =
CreatePasswordFormFromDataForTesting(www_form_data_facebook);
- scoped_ptr<PasswordForm> form_facebook_old =
+ std::unique_ptr<PasswordForm> form_facebook_old =
CreatePasswordFormFromDataForTesting(www_form_data_facebook_old);
- scoped_ptr<PasswordForm> form_other =
+ std::unique_ptr<PasswordForm> form_other =
CreatePasswordFormFromDataForTesting(www_form_data_other);
base::Time now = base::Time::Now();
base::Time next_day = now + base::TimeDelta::FromDays(1);
@@ -1698,7 +1699,7 @@ TEST_F(PasswordStoreMacTest, TestDisableAutoSignInForAllLogins) {
true,
false,
0};
- scoped_ptr<PasswordForm> form_facebook =
+ std::unique_ptr<PasswordForm> form_facebook =
CreatePasswordFormFromDataForTesting(www_form_data_facebook);
form_facebook->skip_zero_click = false;
@@ -1739,7 +1740,7 @@ TEST_F(PasswordStoreMacTest, TestRemoveLoginsMultiProfile) {
PasswordForm::SCHEME_HTML, "http://www.facebook.com/",
"http://www.facebook.com/index.html", "login", L"username", L"password",
L"submit", L"joe_user", L"sekrit", true, false, 1 };
- scoped_ptr<PasswordForm> www_form =
+ std::unique_ptr<PasswordForm> www_form =
CreatePasswordFormFromDataForTesting(www_form_data1);
EXPECT_TRUE(owned_keychain_adapter.AddPassword(*www_form));
@@ -1791,7 +1792,7 @@ TEST_F(PasswordStoreMacTest, SilentlyRemoveOrphanedForm) {
"http://www.facebook.com/index.html", "login",
L"username", L"password", L"submit", L"joe_user", L"", true, false, 1
};
- scoped_ptr<PasswordForm> www_form(
+ std::unique_ptr<PasswordForm> www_form(
CreatePasswordFormFromDataForTesting(www_form_data));
EXPECT_EQ(AddChangeForForm(*www_form), login_db()->AddLogin(*www_form));
« no previous file with comments | « chrome/browser/password_manager/password_store_mac.cc ('k') | chrome/browser/password_manager/password_store_proxy_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698