OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/autofill/autofill_common_test.h" | 11 #include "chrome/browser/autofill/autofill_common_test.h" |
12 #include "chrome/browser/autofill/autofill_profile.h" | 12 #include "chrome/browser/autofill/autofill_profile.h" |
13 #include "chrome/common/guid.h" | 13 #include "chrome/common/guid.h" |
14 #include "chrome/test/base/testing_browser_process_test.h" | |
15 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
20 bool UpdateProfileLabel(AutofillProfile *profile) { | 19 bool UpdateProfileLabel(AutofillProfile *profile) { |
21 std::vector<AutofillProfile*> profiles; | 20 std::vector<AutofillProfile*> profiles; |
22 profiles.push_back(profile); | 21 profiles.push_back(profile); |
23 return AutofillProfile::AdjustInferredLabels(&profiles); | 22 return AutofillProfile::AdjustInferredLabels(&profiles); |
24 } | 23 } |
25 | 24 |
26 } // namespace | 25 } // namespace |
27 | 26 |
28 typedef TestingBrowserProcessTest AutofillProfileTest; | 27 typedef testing::Test AutofillProfileTest; |
29 | 28 |
30 // Tests different possibilities for summary string generation. | 29 // Tests different possibilities for summary string generation. |
31 // Based on existence of first name, last name, and address line 1. | 30 // Based on existence of first name, last name, and address line 1. |
32 TEST_F(AutofillProfileTest, PreviewSummaryString) { | 31 TEST_F(AutofillProfileTest, PreviewSummaryString) { |
33 // Case 0/null: "" | 32 // Case 0/null: "" |
34 AutofillProfile profile0; | 33 AutofillProfile profile0; |
35 // Empty profile - nothing to update. | 34 // Empty profile - nothing to update. |
36 EXPECT_FALSE(UpdateProfileLabel(&profile0)); | 35 EXPECT_FALSE(UpdateProfileLabel(&profile0)); |
37 string16 summary0 = profile0.Label(); | 36 string16 summary0 = profile0.Label(); |
38 EXPECT_EQ(string16(), summary0); | 37 EXPECT_EQ(string16(), summary0); |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 // Delete values. | 830 // Delete values. |
832 set_values.clear(); | 831 set_values.clear(); |
833 p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); | 832 p.SetMultiInfo(PHONE_FAX_WHOLE_NUMBER, set_values); |
834 p.GetMultiInfo(PHONE_FAX_WHOLE_NUMBER, &get_values); | 833 p.GetMultiInfo(PHONE_FAX_WHOLE_NUMBER, &get_values); |
835 ASSERT_EQ(1UL, get_values.size()); | 834 ASSERT_EQ(1UL, get_values.size()); |
836 EXPECT_EQ(string16(), get_values[0]); | 835 EXPECT_EQ(string16(), get_values[0]); |
837 | 836 |
838 // Expect regular |GetInfo| returns empty value. | 837 // Expect regular |GetInfo| returns empty value. |
839 EXPECT_EQ(string16(), p.GetInfo(PHONE_FAX_WHOLE_NUMBER)); | 838 EXPECT_EQ(string16(), p.GetInfo(PHONE_FAX_WHOLE_NUMBER)); |
840 } | 839 } |
OLD | NEW |