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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 367 } |
368 | 368 |
369 // Returns true if there are autofill profiles. | 369 // Returns true if there are autofill profiles. |
370 bool HasProfile() { | 370 bool HasProfile() { |
371 return !personal_data_manager_->profiles().empty() && | 371 return !personal_data_manager_->profiles().empty() && |
372 !personal_data_manager_->credit_cards().empty(); | 372 !personal_data_manager_->credit_cards().empty(); |
373 } | 373 } |
374 | 374 |
375 void AddProfile() { | 375 void AddProfile() { |
376 AutofillProfile profile; | 376 AutofillProfile profile; |
377 profile.SetInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 377 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
378 profile.SetInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 378 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
379 profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("94043")); | 379 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("94043")); |
380 profile.SetInfo(EMAIL_ADDRESS, ASCIIToUTF16("sue@example.com")); | 380 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("sue@example.com")); |
381 profile.SetInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); | 381 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); |
382 | 382 |
383 std::vector<AutofillProfile> profiles; | 383 std::vector<AutofillProfile> profiles; |
384 profiles.push_back(profile); | 384 profiles.push_back(profile); |
385 personal_data_manager_->SetProfiles(&profiles); | 385 personal_data_manager_->SetProfiles(&profiles); |
386 MessageLoop::current()->Run(); | 386 MessageLoop::current()->Run(); |
387 | 387 |
388 CreditCard card; | 388 CreditCard card; |
389 card.SetInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("1234-5678-9012-3456")); | 389 card.SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("1234-5678-9012-3456")); |
390 | 390 |
391 std::vector<CreditCard> cards; | 391 std::vector<CreditCard> cards; |
392 cards.push_back(card); | 392 cards.push_back(card); |
393 personal_data_manager_->SetCreditCards(&cards); | 393 personal_data_manager_->SetCreditCards(&cards); |
394 MessageLoop::current()->Run(); | 394 MessageLoop::current()->Run(); |
395 } | 395 } |
396 | 396 |
397 private: | 397 private: |
398 virtual void OnPersonalDataChanged() OVERRIDE { | 398 virtual void OnPersonalDataChanged() OVERRIDE { |
399 MessageLoop::current()->Quit(); | 399 MessageLoop::current()->Quit(); |
(...skipping 817 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 |