OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/guid.h" |
6 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
7 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
8 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
9 #include "base/string16.h" | 10 #include "base/string16.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/autofill/autofill_common_test.h" | 12 #include "chrome/browser/autofill/autofill_common_test.h" |
12 #include "chrome/browser/autofill/autofill_profile.h" | 13 #include "chrome/browser/autofill/autofill_profile.h" |
13 #include "chrome/common/guid.h" | |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 bool UpdateProfileLabel(AutofillProfile *profile) { | 19 bool UpdateProfileLabel(AutofillProfile *profile) { |
20 std::vector<AutofillProfile*> profiles; | 20 std::vector<AutofillProfile*> profiles; |
21 profiles.push_back(profile); | 21 profiles.push_back(profile); |
22 return AutofillProfile::AdjustInferredLabels(&profiles); | 22 return AutofillProfile::AdjustInferredLabels(&profiles); |
23 } | 23 } |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 EXPECT_TRUE(a == b); | 560 EXPECT_TRUE(a == b); |
561 } | 561 } |
562 | 562 |
563 TEST_F(AutofillProfileTest, Compare) { | 563 TEST_F(AutofillProfileTest, Compare) { |
564 AutofillProfile a, b; | 564 AutofillProfile a, b; |
565 | 565 |
566 // Empty profiles are the same. | 566 // Empty profiles are the same. |
567 EXPECT_EQ(0, a.Compare(b)); | 567 EXPECT_EQ(0, a.Compare(b)); |
568 | 568 |
569 // GUIDs don't count. | 569 // GUIDs don't count. |
570 a.set_guid(guid::GenerateGUID()); | 570 a.set_guid(base::GenerateGUID()); |
571 b.set_guid(guid::GenerateGUID()); | 571 b.set_guid(base::GenerateGUID()); |
572 EXPECT_EQ(0, a.Compare(b)); | 572 EXPECT_EQ(0, a.Compare(b)); |
573 | 573 |
574 // Different values produce non-zero results. | 574 // Different values produce non-zero results. |
575 autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL, | 575 autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL, |
576 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 576 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
577 autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL, | 577 autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL, |
578 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 578 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
579 EXPECT_GT(0, a.Compare(b)); | 579 EXPECT_GT(0, a.Compare(b)); |
580 EXPECT_LT(0, b.Compare(a)); | 580 EXPECT_LT(0, b.Compare(a)); |
581 } | 581 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // Delete values. | 706 // Delete values. |
707 set_values.clear(); | 707 set_values.clear(); |
708 p.SetMultiInfo(PHONE_HOME_WHOLE_NUMBER, set_values); | 708 p.SetMultiInfo(PHONE_HOME_WHOLE_NUMBER, set_values); |
709 p.GetMultiInfo(PHONE_HOME_WHOLE_NUMBER, &get_values); | 709 p.GetMultiInfo(PHONE_HOME_WHOLE_NUMBER, &get_values); |
710 ASSERT_EQ(1UL, get_values.size()); | 710 ASSERT_EQ(1UL, get_values.size()); |
711 EXPECT_EQ(string16(), get_values[0]); | 711 EXPECT_EQ(string16(), get_values[0]); |
712 | 712 |
713 // Expect regular |GetInfo| returns empty value. | 713 // Expect regular |GetInfo| returns empty value. |
714 EXPECT_EQ(string16(), p.GetInfo(PHONE_HOME_WHOLE_NUMBER)); | 714 EXPECT_EQ(string16(), p.GetInfo(PHONE_HOME_WHOLE_NUMBER)); |
715 } | 715 } |
OLD | NEW |