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

Side by Side Diff: chrome/browser/autofill/credit_card_unittest.cc

Issue 5521005: AutoFillProfile: Don't clobber data on self-assignment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar bettar Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autofill/credit_card.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chrome/browser/autofill/credit_card.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698