| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string16.h" | 5 #include "base/string16.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 8 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
| 9 #include "chrome/browser/sync/glue/autofill_model_associator2.h" |
| 9 | 10 |
| 10 using browser_sync::AutofillModelAssociator; | 11 using browser_sync::AutofillModelAssociator; |
| 11 | 12 |
| 12 class AutofillModelAssociatorTest : public testing::Test { | 13 class AutofillModelAssociatorTest : public testing::Test { |
| 13 }; | 14 }; |
| 14 | 15 |
| 15 TEST_F(AutofillModelAssociatorTest, KeyToTag) { | 16 TEST_F(AutofillModelAssociatorTest, KeyToTag) { |
| 16 EXPECT_EQ("autofill_entry|foo|bar", | 17 EXPECT_EQ("autofill_entry|foo|bar", |
| 17 AutofillModelAssociator::KeyToTag(UTF8ToUTF16("foo"), | 18 AutofillModelAssociator::KeyToTag(UTF8ToUTF16("foo"), |
| 18 UTF8ToUTF16("bar"))); | 19 UTF8ToUTF16("bar"))); |
| 19 EXPECT_EQ("autofill_entry|%7C|%7C", | 20 EXPECT_EQ("autofill_entry|%7C|%7C", |
| 20 AutofillModelAssociator::KeyToTag(UTF8ToUTF16("|"), | 21 AutofillModelAssociator::KeyToTag(UTF8ToUTF16("|"), |
| 21 UTF8ToUTF16("|"))); | 22 UTF8ToUTF16("|"))); |
| 22 EXPECT_EQ("autofill_entry|%7C|", | 23 EXPECT_EQ("autofill_entry|%7C|", |
| 23 AutofillModelAssociator::KeyToTag(UTF8ToUTF16("|"), | 24 AutofillModelAssociator::KeyToTag(UTF8ToUTF16("|"), |
| 24 UTF8ToUTF16(""))); | 25 UTF8ToUTF16(""))); |
| 25 EXPECT_EQ("autofill_entry||%7C", | 26 EXPECT_EQ("autofill_entry||%7C", |
| 26 AutofillModelAssociator::KeyToTag(UTF8ToUTF16(""), | 27 AutofillModelAssociator::KeyToTag(UTF8ToUTF16(""), |
| 27 UTF8ToUTF16("|"))); | 28 UTF8ToUTF16("|"))); |
| 28 } | 29 } |
| 29 | |
| 30 TEST_F(AutofillModelAssociatorTest, ProfileLabelToTag) { | |
| 31 string16 label(ASCIIToUTF16("awesome_address")); | |
| 32 EXPECT_EQ("autofill_profile|awesome_address", | |
| 33 AutofillModelAssociator::ProfileLabelToTag(label)); | |
| 34 | |
| 35 EXPECT_EQ("autofill_profile|%7C%7C", | |
| 36 AutofillModelAssociator::ProfileLabelToTag(ASCIIToUTF16("||"))); | |
| 37 EXPECT_NE(AutofillModelAssociator::KeyToTag(ASCIIToUTF16("autofill_profile"), | |
| 38 ASCIIToUTF16("home")), | |
| 39 AutofillModelAssociator::ProfileLabelToTag(ASCIIToUTF16("home"))); | |
| 40 } | |
| OLD | NEW |