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

Side by Side Diff: components/autofill/browser/autofill_type_unittest.cc

Issue 17392006: In components/autofill, move browser/ to core/browser/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to fix conflicts Created 7 years, 6 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/autofill/browser/autofill_type.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace autofill {
9 namespace {
10
11 TEST(AutofillTypeTest, AutofillTypes) {
12 // No server data.
13 AutofillType none(NO_SERVER_DATA);
14 EXPECT_EQ(NO_SERVER_DATA, none.field_type());
15 EXPECT_EQ(AutofillType::NO_GROUP, none.group());
16
17 // Unknown type.
18 AutofillType unknown(UNKNOWN_TYPE);
19 EXPECT_EQ(UNKNOWN_TYPE, unknown.field_type());
20 EXPECT_EQ(AutofillType::NO_GROUP, unknown.group());
21
22 // Type with group but no subgroup.
23 AutofillType first(NAME_FIRST);
24 EXPECT_EQ(NAME_FIRST, first.field_type());
25 EXPECT_EQ(AutofillType::NAME, first.group());
26
27 // Type with group and subgroup.
28 AutofillType phone(PHONE_HOME_NUMBER);
29 EXPECT_EQ(PHONE_HOME_NUMBER, phone.field_type());
30 EXPECT_EQ(AutofillType::PHONE_HOME, phone.group());
31
32 // Last value, to check any offset errors.
33 AutofillType last(COMPANY_NAME);
34 EXPECT_EQ(COMPANY_NAME, last.field_type());
35 EXPECT_EQ(AutofillType::COMPANY, last.group());
36
37 // Boundary (error) condition.
38 AutofillType boundary(MAX_VALID_FIELD_TYPE);
39 EXPECT_EQ(UNKNOWN_TYPE, boundary.field_type());
40 EXPECT_EQ(AutofillType::NO_GROUP, boundary.group());
41
42 // Beyond the boundary (error) condition.
43 AutofillType beyond(static_cast<AutofillFieldType>(MAX_VALID_FIELD_TYPE+10));
44 EXPECT_EQ(UNKNOWN_TYPE, beyond.field_type());
45 EXPECT_EQ(AutofillType::NO_GROUP, beyond.group());
46
47 // In-between value. Missing from enum but within range. Error condition.
48 AutofillType between(static_cast<AutofillFieldType>(16));
49 EXPECT_EQ(UNKNOWN_TYPE, between.field_type());
50 EXPECT_EQ(AutofillType::NO_GROUP, between.group());
51 }
52
53 } // namespace
54 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_type.cc ('k') | components/autofill/browser/autofill_xml_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698