| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 } | 439 } |
| 440 | 440 |
| 441 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { | 441 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { |
| 442 public: | 442 public: |
| 443 RemoveSafeBrowsingCookieTester() | 443 RemoveSafeBrowsingCookieTester() |
| 444 : browser_process_(TestingBrowserProcess::GetGlobal()) { | 444 : browser_process_(TestingBrowserProcess::GetGlobal()) { |
| 445 scoped_refptr<safe_browsing::SafeBrowsingService> sb_service = | 445 scoped_refptr<safe_browsing::SafeBrowsingService> sb_service = |
| 446 safe_browsing::SafeBrowsingService::CreateSafeBrowsingService(); | 446 safe_browsing::SafeBrowsingService::CreateSafeBrowsingService(); |
| 447 browser_process_->SetSafeBrowsingService(sb_service.get()); | 447 browser_process_->SetSafeBrowsingService(sb_service.get()); |
| 448 sb_service->Initialize(); | 448 sb_service->Initialize(); |
| 449 base::MessageLoop::current()->RunUntilIdle(); | 449 base::RunLoop().RunUntilIdle(); |
| 450 | 450 |
| 451 // Make sure the safe browsing cookie store has no cookies. | 451 // Make sure the safe browsing cookie store has no cookies. |
| 452 // TODO(mmenke): Is this really needed? | 452 // TODO(mmenke): Is this really needed? |
| 453 base::RunLoop run_loop; | 453 base::RunLoop run_loop; |
| 454 net::URLRequestContext* request_context = | 454 net::URLRequestContext* request_context = |
| 455 sb_service->url_request_context()->GetURLRequestContext(); | 455 sb_service->url_request_context()->GetURLRequestContext(); |
| 456 request_context->cookie_store()->DeleteAllAsync( | 456 request_context->cookie_store()->DeleteAllAsync( |
| 457 base::Bind(&RunClosureAfterCookiesCleared, run_loop.QuitClosure())); | 457 base::Bind(&RunClosureAfterCookiesCleared, run_loop.QuitClosure())); |
| 458 run_loop.Run(); | 458 run_loop.Run(); |
| 459 | 459 |
| 460 SetCookieStore(request_context->cookie_store()); | 460 SetCookieStore(request_context->cookie_store()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 virtual ~RemoveSafeBrowsingCookieTester() { | 463 virtual ~RemoveSafeBrowsingCookieTester() { |
| 464 browser_process_->safe_browsing_service()->ShutDown(); | 464 browser_process_->safe_browsing_service()->ShutDown(); |
| 465 base::MessageLoop::current()->RunUntilIdle(); | 465 base::RunLoop().RunUntilIdle(); |
| 466 browser_process_->SetSafeBrowsingService(nullptr); | 466 browser_process_->SetSafeBrowsingService(nullptr); |
| 467 } | 467 } |
| 468 | 468 |
| 469 private: | 469 private: |
| 470 TestingBrowserProcess* browser_process_; | 470 TestingBrowserProcess* browser_process_; |
| 471 | 471 |
| 472 DISALLOW_COPY_AND_ASSIGN(RemoveSafeBrowsingCookieTester); | 472 DISALLOW_COPY_AND_ASSIGN(RemoveSafeBrowsingCookieTester); |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 class RemoveChannelIDTester : public net::SSLConfigService::Observer { | 475 class RemoveChannelIDTester : public net::SSLConfigService::Observer { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 profile.SetRawInfo(autofill::EMAIL_ADDRESS, | 725 profile.SetRawInfo(autofill::EMAIL_ADDRESS, |
| 726 base::ASCIIToUTF16("sue@example.com")); | 726 base::ASCIIToUTF16("sue@example.com")); |
| 727 profile.SetRawInfo(autofill::COMPANY_NAME, base::ASCIIToUTF16("Company X")); | 727 profile.SetRawInfo(autofill::COMPANY_NAME, base::ASCIIToUTF16("Company X")); |
| 728 profiles.push_back(profile); | 728 profiles.push_back(profile); |
| 729 | 729 |
| 730 profile.set_guid(base::GenerateGUID()); | 730 profile.set_guid(base::GenerateGUID()); |
| 731 profile.set_origin(autofill::kSettingsOrigin); | 731 profile.set_origin(autofill::kSettingsOrigin); |
| 732 profiles.push_back(profile); | 732 profiles.push_back(profile); |
| 733 | 733 |
| 734 personal_data_manager_->SetProfiles(&profiles); | 734 personal_data_manager_->SetProfiles(&profiles); |
| 735 base::MessageLoop::current()->Run(); | 735 base::RunLoop().Run(); |
| 736 | 736 |
| 737 std::vector<autofill::CreditCard> cards; | 737 std::vector<autofill::CreditCard> cards; |
| 738 autofill::CreditCard card; | 738 autofill::CreditCard card; |
| 739 card.set_guid(base::GenerateGUID()); | 739 card.set_guid(base::GenerateGUID()); |
| 740 card.set_origin(kWebOrigin); | 740 card.set_origin(kWebOrigin); |
| 741 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, | 741 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, |
| 742 base::ASCIIToUTF16("1234-5678-9012-3456")); | 742 base::ASCIIToUTF16("1234-5678-9012-3456")); |
| 743 cards.push_back(card); | 743 cards.push_back(card); |
| 744 | 744 |
| 745 card.set_guid(base::GenerateGUID()); | 745 card.set_guid(base::GenerateGUID()); |
| 746 card.set_origin(autofill::kSettingsOrigin); | 746 card.set_origin(autofill::kSettingsOrigin); |
| 747 cards.push_back(card); | 747 cards.push_back(card); |
| 748 | 748 |
| 749 personal_data_manager_->SetCreditCards(&cards); | 749 personal_data_manager_->SetCreditCards(&cards); |
| 750 base::MessageLoop::current()->Run(); | 750 base::RunLoop().Run(); |
| 751 } | 751 } |
| 752 | 752 |
| 753 private: | 753 private: |
| 754 void OnPersonalDataChanged() override { | 754 void OnPersonalDataChanged() override { |
| 755 base::MessageLoop::current()->QuitWhenIdle(); | 755 base::MessageLoop::current()->QuitWhenIdle(); |
| 756 } | 756 } |
| 757 | 757 |
| 758 autofill::PersonalDataManager* personal_data_manager_; | 758 autofill::PersonalDataManager* personal_data_manager_; |
| 759 DISALLOW_COPY_AND_ASSIGN(RemoveAutofillTester); | 759 DISALLOW_COPY_AND_ASSIGN(RemoveAutofillTester); |
| 760 }; | 760 }; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 #if defined(ENABLE_EXTENSIONS) | 1023 #if defined(ENABLE_EXTENSIONS) |
| 1024 mock_policy_ = nullptr; | 1024 mock_policy_ = nullptr; |
| 1025 #endif | 1025 #endif |
| 1026 | 1026 |
| 1027 // TestingProfile contains a DOMStorageContext. BrowserContext's destructor | 1027 // TestingProfile contains a DOMStorageContext. BrowserContext's destructor |
| 1028 // posts a message to the WEBKIT thread to delete some of its member | 1028 // posts a message to the WEBKIT thread to delete some of its member |
| 1029 // variables. We need to ensure that the profile is destroyed, and that | 1029 // variables. We need to ensure that the profile is destroyed, and that |
| 1030 // the message loop is cleared out, before destroying the threads and loop. | 1030 // the message loop is cleared out, before destroying the threads and loop. |
| 1031 // Otherwise we leak memory. | 1031 // Otherwise we leak memory. |
| 1032 profile_.reset(); | 1032 profile_.reset(); |
| 1033 base::MessageLoop::current()->RunUntilIdle(); | 1033 base::RunLoop().RunUntilIdle(); |
| 1034 | 1034 |
| 1035 TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); | 1035 TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 void BlockUntilBrowsingDataRemoved(BrowsingDataRemover::TimePeriod period, | 1038 void BlockUntilBrowsingDataRemoved(BrowsingDataRemover::TimePeriod period, |
| 1039 int remove_mask, | 1039 int remove_mask, |
| 1040 bool include_protected_origins) { | 1040 bool include_protected_origins) { |
| 1041 BrowsingDataRemover* remover = | 1041 BrowsingDataRemover* remover = |
| 1042 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); | 1042 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); |
| 1043 | 1043 |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2537 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( | 2537 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( |
| 2538 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, | 2538 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, |
| 2539 base::Bind(&MatchPrimaryPattern, http_pattern)); | 2539 base::Bind(&MatchPrimaryPattern, http_pattern)); |
| 2540 // Verify we only have one, and it's url1. | 2540 // Verify we only have one, and it's url1. |
| 2541 host_content_settings_map->GetSettingsForOneType( | 2541 host_content_settings_map->GetSettingsForOneType( |
| 2542 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); | 2542 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); |
| 2543 EXPECT_EQ(1u, host_settings.size()); | 2543 EXPECT_EQ(1u, host_settings.size()); |
| 2544 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), | 2544 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), |
| 2545 host_settings[0].primary_pattern); | 2545 host_settings[0].primary_pattern); |
| 2546 } | 2546 } |
| OLD | NEW |