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

Unified Diff: components/autofill/browser/autofill_field_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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/browser/autofill_field_unittest.cc
diff --git a/components/autofill/browser/autofill_field_unittest.cc b/components/autofill/browser/autofill_field_unittest.cc
deleted file mode 100644
index 2072d23cfc29d290bd9b47bbf31def1d9f2602f3..0000000000000000000000000000000000000000
--- a/components/autofill/browser/autofill_field_unittest.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "components/autofill/browser/autofill_field.h"
-#include "components/autofill/browser/field_types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace autofill {
-namespace {
-
-TEST(AutofillFieldTest, Type) {
- AutofillField field;
- ASSERT_EQ(NO_SERVER_DATA, field.server_type());
- ASSERT_EQ(UNKNOWN_TYPE, field.heuristic_type());
-
- // |server_type_| is NO_SERVER_DATA, so |heuristic_type_| is returned.
- EXPECT_EQ(UNKNOWN_TYPE, field.type());
-
- // Set the heuristic type and check it.
- field.set_heuristic_type(NAME_FIRST);
- EXPECT_EQ(NAME_FIRST, field.type());
-
- // Set the server type and check it.
- field.set_server_type(ADDRESS_BILLING_LINE1);
- EXPECT_EQ(ADDRESS_BILLING_LINE1, field.type());
-
- // Remove the server type to make sure the heuristic type is preserved.
- field.set_server_type(NO_SERVER_DATA);
- EXPECT_EQ(NAME_FIRST, field.type());
-}
-
-TEST(AutofillFieldTest, IsEmpty) {
- AutofillField field;
- ASSERT_EQ(base::string16(), field.value);
-
- // Field value is empty.
- EXPECT_TRUE(field.IsEmpty());
-
- // Field value is non-empty.
- field.value = ASCIIToUTF16("Value");
- EXPECT_FALSE(field.IsEmpty());
-}
-
-TEST(AutofillFieldTest, FieldSignature) {
- AutofillField field;
- ASSERT_EQ(base::string16(), field.name);
- ASSERT_EQ(std::string(), field.form_control_type);
-
- // Signature is empty.
- EXPECT_EQ("2085434232", field.FieldSignature());
-
- // Field name is set.
- field.name = ASCIIToUTF16("Name");
- EXPECT_EQ("1606968241", field.FieldSignature());
-
- // Field form control type is set.
- field.form_control_type = "text";
- EXPECT_EQ("502192749", field.FieldSignature());
-
- // Heuristic type does not affect FieldSignature.
- field.set_heuristic_type(NAME_FIRST);
- EXPECT_EQ("502192749", field.FieldSignature());
-
- // Server type does not affect FieldSignature.
- field.set_server_type(NAME_LAST);
- EXPECT_EQ("502192749", field.FieldSignature());
-}
-
-TEST(AutofillFieldTest, IsFieldFillable) {
- AutofillField field;
- ASSERT_EQ(UNKNOWN_TYPE, field.type());
-
- // Type is unknown.
- EXPECT_FALSE(field.IsFieldFillable());
-
- // Only heuristic type is set.
- field.set_heuristic_type(NAME_FIRST);
- EXPECT_TRUE(field.IsFieldFillable());
-
- // Only server type is set.
- field.set_heuristic_type(UNKNOWN_TYPE);
- field.set_server_type(NAME_LAST);
- EXPECT_TRUE(field.IsFieldFillable());
-
- // Both types set.
- field.set_heuristic_type(NAME_FIRST);
- field.set_server_type(NAME_LAST);
- EXPECT_TRUE(field.IsFieldFillable());
-}
-
-} // namespace
-} // namespace autofill
« no previous file with comments | « components/autofill/browser/autofill_field.cc ('k') | components/autofill/browser/autofill_ie_toolbar_import_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698