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

Unified Diff: components/autofill/core/browser/form_field_unittest.cc

Issue 2609703002: Remove ScopedVector from autofill. (Closed)
Patch Set: drop the using Created 3 years, 12 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
« no previous file with comments | « components/autofill/core/browser/form_field.cc ('k') | components/autofill/core/browser/form_structure.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/form_field_unittest.cc
diff --git a/components/autofill/core/browser/form_field_unittest.cc b/components/autofill/core/browser/form_field_unittest.cc
index 71e5e12d4766407cf3160a455be95ec7c22c823a..8962409833cd3e7fc4d153ffd6ef8a95e7e4dc4a 100644
--- a/components/autofill/core/browser/form_field_unittest.cc
+++ b/components/autofill/core/browser/form_field_unittest.cc
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_vector.h"
+#include <memory>
+#include <vector>
+
+#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_field.h"
@@ -124,32 +127,36 @@ TEST(FormFieldTest, Match) {
// Test that we ignore checkable elements.
TEST(FormFieldTest, ParseFormFields) {
- ScopedVector<AutofillField> fields;
+ std::vector<std::unique_ptr<AutofillField>> fields;
FormFieldData field_data;
field_data.form_control_type = "text";
field_data.label = ASCIIToUTF16("Address line1");
- fields.push_back(new AutofillField(field_data, field_data.label));
+ fields.push_back(
+ base::MakeUnique<AutofillField>(field_data, field_data.label));
field_data.check_status = FormFieldData::CHECKABLE_BUT_UNCHECKED;
field_data.label = ASCIIToUTF16("Is PO Box");
- fields.push_back(new AutofillField(field_data, field_data.label));
+ fields.push_back(
+ base::MakeUnique<AutofillField>(field_data, field_data.label));
// reset |is_checkable| to false.
field_data.check_status = FormFieldData::NOT_CHECKABLE;
field_data.label = ASCIIToUTF16("Address line2");
- fields.push_back(new AutofillField(field_data, field_data.label));
+ fields.push_back(
+ base::MakeUnique<AutofillField>(field_data, field_data.label));
// Does not parse since there are only 2 recognized fields.
- ASSERT_TRUE(FormField::ParseFormFields(fields.get(), true).empty());
+ ASSERT_TRUE(FormField::ParseFormFields(fields, true).empty());
field_data.label = ASCIIToUTF16("City");
- fields.push_back(new AutofillField(field_data, field_data.label));
+ fields.push_back(
+ base::MakeUnique<AutofillField>(field_data, field_data.label));
// Checkable element shouldn't interfere with inference of Address line2.
const FieldCandidatesMap field_candidates_map =
- FormField::ParseFormFields(fields.get(), true);
+ FormField::ParseFormFields(fields, true);
ASSERT_EQ(3U, field_candidates_map.size());
EXPECT_EQ(ADDRESS_HOME_LINE1,
@@ -170,11 +177,11 @@ TEST(FormFieldTest, ParseFormFieldsImmutableForm) {
field_data.form_control_type = "text";
field_data.name = ASCIIToUTF16("business_email_address");
- ScopedVector<AutofillField> fields;
- fields.push_back(new AutofillField(field_data, unique_name));
+ std::vector<std::unique_ptr<AutofillField>> fields;
+ fields.push_back(base::MakeUnique<AutofillField>(field_data, unique_name));
const FieldCandidatesMap field_candidates_map =
- FormField::ParseFormFields(fields.get(), true);
+ FormField::ParseFormFields(fields, true);
// The input form should not be modified.
EXPECT_EQ(1U, fields.size());
« no previous file with comments | « components/autofill/core/browser/form_field.cc ('k') | components/autofill/core/browser/form_structure.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698