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/guid.h" |
6 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
7 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
8 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autofill/autofill_common_test.h" | 11 #include "chrome/browser/autofill/autofill_common_test.h" |
11 #include "chrome/browser/autofill/autofill_profile.h" | 12 #include "chrome/browser/autofill/autofill_profile.h" |
12 #include "chrome/browser/autofill/form_structure.h" | 13 #include "chrome/browser/autofill/form_structure.h" |
13 #include "chrome/browser/autofill/personal_data_manager.h" | 14 #include "chrome/browser/autofill/personal_data_manager.h" |
14 #include "chrome/browser/browser_thread.h" | 15 #include "chrome/browser/browser_thread.h" |
15 #include "chrome/browser/guid.h" | |
16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
17 #include "chrome/browser/password_manager/encryptor.h" | 17 #include "chrome/browser/password_manager/encryptor.h" |
18 #include "chrome/common/notification_details.h" | 18 #include "chrome/common/notification_details.h" |
19 #include "chrome/common/notification_observer_mock.h" | 19 #include "chrome/common/notification_observer_mock.h" |
20 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
21 #include "chrome/common/notification_service.h" | 21 #include "chrome/common/notification_service.h" |
22 #include "chrome/common/notification_type.h" | 22 #include "chrome/common/notification_type.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "chrome/test/testing_profile.h" | 24 #include "chrome/test/testing_profile.h" |
25 #include "webkit/glue/form_data.h" | 25 #include "webkit/glue/form_data.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 update.clear(); | 326 update.clear(); |
327 update.push_back(*results2[0]); | 327 update.push_back(*results2[0]); |
328 update.push_back(profile1); | 328 update.push_back(profile1); |
329 personal_data_->SetProfiles(&update); | 329 personal_data_->SetProfiles(&update); |
330 | 330 |
331 // Make sure the two profiles have different ids (and neither equal to 0, | 331 // Make sure the two profiles have different ids (and neither equal to 0, |
332 // which is an invalid id). | 332 // which is an invalid id). |
333 const std::vector<AutoFillProfile*>& results3 = personal_data_->profiles(); | 333 const std::vector<AutoFillProfile*>& results3 = personal_data_->profiles(); |
334 ASSERT_EQ(2U, results3.size()); | 334 ASSERT_EQ(2U, results3.size()); |
335 EXPECT_NE(results3[0]->guid(), results3[1]->guid()); | 335 EXPECT_NE(results3[0]->guid(), results3[1]->guid()); |
336 EXPECT_TRUE(guid::IsValidGUID(results3[0]->guid())); | 336 EXPECT_TRUE(base::IsValidGUID(results3[0]->guid())); |
337 EXPECT_TRUE(guid::IsValidGUID(results3[1]->guid())); | 337 EXPECT_TRUE(base::IsValidGUID(results3[1]->guid())); |
338 } | 338 } |
339 | 339 |
340 TEST_F(PersonalDataManagerTest, SetEmptyProfile) { | 340 TEST_F(PersonalDataManagerTest, SetEmptyProfile) { |
341 AutoFillProfile profile0; | 341 AutoFillProfile profile0; |
342 autofill_test::SetProfileInfo(&profile0, | 342 autofill_test::SetProfileInfo(&profile0, |
343 "", "", "", "", "", "", "", "", "", "", "", "", "", ""); | 343 "", "", "", "", "", "", "", "", "", "", "", "", "", ""); |
344 | 344 |
345 // This will verify that the web database has been loaded and the notification | 345 // This will verify that the web database has been loaded and the notification |
346 // sent out. | 346 // sent out. |
347 EXPECT_CALL(personal_data_observer_, | 347 EXPECT_CALL(personal_data_observer_, |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 | 1378 |
1379 // Expect that the newer information is saved. In this case the year is | 1379 // Expect that the newer information is saved. In this case the year is |
1380 // added to the existing credit card. | 1380 // added to the existing credit card. |
1381 CreditCard expected2; | 1381 CreditCard expected2; |
1382 autofill_test::SetCreditCardInfo(&expected2, | 1382 autofill_test::SetCreditCardInfo(&expected2, |
1383 "L1", "Biggie Smalls", "4111111111111111", "01", "2011"); | 1383 "L1", "Biggie Smalls", "4111111111111111", "01", "2011"); |
1384 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1384 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); |
1385 ASSERT_EQ(1U, results2.size()); | 1385 ASSERT_EQ(1U, results2.size()); |
1386 EXPECT_EQ(0, expected2.Compare(*results2[0])); | 1386 EXPECT_EQ(0, expected2.Compare(*results2[0])); |
1387 } | 1387 } |
1388 | |
OLD | NEW |