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

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

Issue 2253233005: Change ScopedVector to vector<unique_ptr> in the password's UI code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android+ 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/passwords_list_view_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm
index 0ea67d61c269c60611a98dcd17a99bac800370a2..a5c3470c505d6b27115de50ed30f4ba43869a234 100644
--- a/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm
@@ -35,18 +35,21 @@ class PasswordsListViewControllerTest : public ManagePasswordsControllerTest {
public:
PasswordsListViewControllerTest() = default;
- void SetUpManageState(const VectorConstFormPtr& forms) {
- ManagePasswordsControllerTest::SetUpManageState(forms);
+ void SetUpManageState(const PasswordFormsVector* forms) {
+ VectorConstFormPtr unique_ptr_forms(forms->size());
+ for (size_t i = 0; i < forms->size(); ++i)
+ unique_ptr_forms[i].reset(new autofill::PasswordForm(forms->at(i)));
+ ManagePasswordsControllerTest::SetUpManageState(unique_ptr_forms);
controller_.reset([[PasswordsListViewController alloc]
- initWithModel:GetModelAndCreateIfNull()
- forms:forms]);
+ initWithModelAndForms:GetModelAndCreateIfNull()
+ forms:forms]);
}
void SetUpPendingState(const autofill::PasswordForm* form) {
ManagePasswordsControllerTest::SetUpSavePendingState(false);
controller_.reset([[PasswordsListViewController alloc]
- initWithModel:GetModelAndCreateIfNull()
- forms:std::vector<const autofill::PasswordForm*>(1, form)]);
+ initWithModelAndForm:GetModelAndCreateIfNull()
+ form:form]);
}
ManagePasswordItemViewController* GetControllerAt(unsigned i) {
@@ -88,10 +91,10 @@ class PasswordsListViewControllerTest : public ManagePasswordsControllerTest {
};
TEST_F(PasswordsListViewControllerTest, ManageStateShouldHaveManageView) {
- ScopedVector<const autofill::PasswordForm> forms;
- forms.push_back(new autofill::PasswordForm(local_credential()));
- forms.push_back(new autofill::PasswordForm(federated_credential()));
- SetUpManageState(forms.get());
+ std::vector<autofill::PasswordForm> forms;
+ forms.push_back(local_credential());
+ forms.push_back(federated_credential());
+ SetUpManageState(&forms);
EXPECT_EQ(MANAGE_PASSWORD_ITEM_STATE_MANAGE, [GetControllerAt(0) state]);
EXPECT_EQ(MANAGE_PASSWORD_ITEM_STATE_MANAGE, [GetControllerAt(1) state]);
@@ -103,9 +106,9 @@ TEST_F(PasswordsListViewControllerTest, ManageStateShouldHaveManageView) {
TEST_F(PasswordsListViewControllerTest,
ClickingDeleteShouldShowUndoViewAndDeletePassword) {
- ScopedVector<const autofill::PasswordForm> forms;
- forms.push_back(new autofill::PasswordForm(local_credential()));
- SetUpManageState(forms.get());
+ std::vector<autofill::PasswordForm> forms;
+ forms.push_back(local_credential());
+ SetUpManageState(&forms);
ManagePasswordItemView* manageView =
base::mac::ObjCCast<ManagePasswordItemView>(
@@ -119,9 +122,9 @@ TEST_F(PasswordsListViewControllerTest,
TEST_F(PasswordsListViewControllerTest,
ClickingUndoShouldShowManageViewAndAddPassword) {
- ScopedVector<const autofill::PasswordForm> forms;
- forms.push_back(new autofill::PasswordForm(local_credential()));
- SetUpManageState(forms.get());
+ std::vector<autofill::PasswordForm> forms;
+ forms.push_back(local_credential());
+ SetUpManageState(&forms);
ManagePasswordItemView* manageView =
base::mac::ObjCCast<ManagePasswordItemView>(
@@ -140,10 +143,10 @@ TEST_F(PasswordsListViewControllerTest,
TEST_F(PasswordsListViewControllerTest,
ManageViewShouldHaveCorrectUsernameAndObscuredPassword) {
- ScopedVector<const autofill::PasswordForm> forms;
- forms.push_back(new autofill::PasswordForm(local_credential()));
- forms.push_back(new autofill::PasswordForm(federated_credential()));
- SetUpManageState(forms.get());
+ std::vector<autofill::PasswordForm> forms;
+ forms.push_back(local_credential());
+ forms.push_back(federated_credential());
+ SetUpManageState(&forms);
ManagePasswordItemView* manageView =
base::mac::ObjCCast<ManagePasswordItemView>(
[GetControllerAt(0) contentView]);

Powered by Google App Engine
This is Rietveld 408576698