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

Side by Side Diff: components/autofill/core/browser/address_field_unittest.cc

Issue 22009003: [Autofill] Distinguish between native field types and potentially HTML field types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/autofill/core/browser/address_field.h" 9 #include "components/autofill/core/browser/address_field.h"
10 #include "components/autofill/core/browser/autofill_field.h" 10 #include "components/autofill/core/browser/autofill_field.h"
11 #include "components/autofill/core/browser/autofill_scanner.h" 11 #include "components/autofill/core/browser/autofill_scanner.h"
12 #include "components/autofill/core/common/form_field_data.h" 12 #include "components/autofill/core/common/form_field_data.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace autofill { 15 namespace autofill {
16 16
17 class AddressFieldTest : public testing::Test { 17 class AddressFieldTest : public testing::Test {
18 public: 18 public:
19 AddressFieldTest() {} 19 AddressFieldTest() {}
20 20
21 protected: 21 protected:
22 ScopedVector<const AutofillField> list_; 22 ScopedVector<const AutofillField> list_;
23 scoped_ptr<AddressField> field_; 23 scoped_ptr<AddressField> field_;
24 FieldTypeMap field_type_map_; 24 ServerFieldTypeMap field_type_map_;
25 25
26 // Downcast for tests. 26 // Downcast for tests.
27 static AddressField* Parse(AutofillScanner* scanner) { 27 static AddressField* Parse(AutofillScanner* scanner) {
28 return static_cast<AddressField*>(AddressField::Parse(scanner)); 28 return static_cast<AddressField*>(AddressField::Parse(scanner));
29 } 29 }
30 30
31 private: 31 private:
32 DISALLOW_COPY_AND_ASSIGN(AddressFieldTest); 32 DISALLOW_COPY_AND_ASSIGN(AddressFieldTest);
33 }; 33 };
34 34
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 field_.reset(Parse(&scanner)); 289 field_.reset(Parse(&scanner));
290 ASSERT_NE(static_cast<AddressField*>(NULL), field_.get()); 290 ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
291 EXPECT_EQ(AddressField::kGenericAddress, field_->FindType()); 291 EXPECT_EQ(AddressField::kGenericAddress, field_->FindType());
292 ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); 292 ASSERT_TRUE(field_->ClassifyField(&field_type_map_));
293 ASSERT_TRUE( 293 ASSERT_TRUE(
294 field_type_map_.find(ASCIIToUTF16("company1")) != field_type_map_.end()); 294 field_type_map_.find(ASCIIToUTF16("company1")) != field_type_map_.end());
295 EXPECT_EQ(COMPANY_NAME, field_type_map_[ASCIIToUTF16("company1")]); 295 EXPECT_EQ(COMPANY_NAME, field_type_map_[ASCIIToUTF16("company1")]);
296 } 296 }
297 297
298 } // namespace autofill 298 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/address_field.cc ('k') | components/autofill/core/browser/address_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698