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 "chrome/browser/browsing_data/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 368 } |
369 | 369 |
370 // Returns true if there are autofill profiles. | 370 // Returns true if there are autofill profiles. |
371 bool HasProfile() { | 371 bool HasProfile() { |
372 return !personal_data_manager_->profiles().empty() && | 372 return !personal_data_manager_->profiles().empty() && |
373 !personal_data_manager_->credit_cards().empty(); | 373 !personal_data_manager_->credit_cards().empty(); |
374 } | 374 } |
375 | 375 |
376 void AddProfile() { | 376 void AddProfile() { |
377 AutofillProfile profile; | 377 AutofillProfile profile; |
378 profile.SetInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 378 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
379 profile.SetInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 379 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
380 profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("94043")); | 380 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("94043")); |
381 profile.SetInfo(EMAIL_ADDRESS, ASCIIToUTF16("sue@example.com")); | 381 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("sue@example.com")); |
382 profile.SetInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); | 382 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); |
383 | 383 |
384 std::vector<AutofillProfile> profiles; | 384 std::vector<AutofillProfile> profiles; |
385 profiles.push_back(profile); | 385 profiles.push_back(profile); |
386 personal_data_manager_->SetProfiles(&profiles); | 386 personal_data_manager_->SetProfiles(&profiles); |
387 MessageLoop::current()->Run(); | 387 MessageLoop::current()->Run(); |
388 | 388 |
389 CreditCard card; | 389 CreditCard card; |
390 card.SetInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("1234-5678-9012-3456")); | 390 card.SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("1234-5678-9012-3456")); |
391 | 391 |
392 std::vector<CreditCard> cards; | 392 std::vector<CreditCard> cards; |
393 cards.push_back(card); | 393 cards.push_back(card); |
394 personal_data_manager_->SetCreditCards(&cards); | 394 personal_data_manager_->SetCreditCards(&cards); |
395 MessageLoop::current()->Run(); | 395 MessageLoop::current()->Run(); |
396 } | 396 } |
397 | 397 |
398 private: | 398 private: |
399 virtual void OnPersonalDataChanged() OVERRIDE { | 399 virtual void OnPersonalDataChanged() OVERRIDE { |
400 MessageLoop::current()->Quit(); | 400 MessageLoop::current()->Quit(); |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 ASSERT_TRUE(tester.HasProfile()); | 1217 ASSERT_TRUE(tester.HasProfile()); |
1218 | 1218 |
1219 BlockUntilBrowsingDataRemoved( | 1219 BlockUntilBrowsingDataRemoved( |
1220 BrowsingDataRemover::EVERYTHING, | 1220 BrowsingDataRemover::EVERYTHING, |
1221 BrowsingDataRemover::REMOVE_FORM_DATA, false); | 1221 BrowsingDataRemover::REMOVE_FORM_DATA, false); |
1222 | 1222 |
1223 EXPECT_EQ(BrowsingDataRemover::REMOVE_FORM_DATA, GetRemovalMask()); | 1223 EXPECT_EQ(BrowsingDataRemover::REMOVE_FORM_DATA, GetRemovalMask()); |
1224 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); | 1224 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); |
1225 ASSERT_FALSE(tester.HasProfile()); | 1225 ASSERT_FALSE(tester.HasProfile()); |
1226 } | 1226 } |
OLD | NEW |