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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autofill/autofill_common_test.h" | 7 #include "chrome/browser/autofill/autofill_common_test.h" |
8 #include "chrome/browser/autofill/credit_card.h" | 8 #include "chrome/browser/autofill/credit_card.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Case 4: Have everything. | 60 // Case 4: Have everything. |
61 CreditCard credit_card4; | 61 CreditCard credit_card4; |
62 autofill_test::SetCreditCardInfo(&credit_card4, "Corporate", | 62 autofill_test::SetCreditCardInfo(&credit_card4, "Corporate", |
63 "John Dillinger", "123456789012", "01", "2010"); | 63 "John Dillinger", "123456789012", "01", "2010"); |
64 string16 summary4 = credit_card4.PreviewSummary(); | 64 string16 summary4 = credit_card4.PreviewSummary(); |
65 EXPECT_EQ(string16(ASCIIToUTF16("************9012, Exp: 01/2010")), summary4); | 65 EXPECT_EQ(string16(ASCIIToUTF16("************9012, Exp: 01/2010")), summary4); |
66 string16 obfuscated4 = credit_card4.ObfuscatedNumber(); | 66 string16 obfuscated4 = credit_card4.ObfuscatedNumber(); |
67 EXPECT_EQ(string16(ASCIIToUTF16("************9012")), obfuscated4); | 67 EXPECT_EQ(string16(ASCIIToUTF16("************9012")), obfuscated4); |
68 } | 68 } |
69 | 69 |
| 70 TEST(CreditCardTest, AssignmentOperator){ |
| 71 CreditCard a, b; |
| 72 |
| 73 // Result of assignment should be logically equal to the original profile. |
| 74 autofill_test::SetCreditCardInfo(&a, "Corporate", "John Dillinger", |
| 75 "123456789012", "01", "2010"); |
| 76 b = a; |
| 77 EXPECT_TRUE(a == b); |
| 78 |
| 79 // Assignment to self should not change the profile value. |
| 80 a = a; |
| 81 EXPECT_TRUE(a == b); |
| 82 } |
| 83 |
70 } // namespace | 84 } // namespace |
71 | 85 |
OLD | NEW |