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 <list> | 5 #include <list> |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/safe_browsing/malware_details.h" | 10 #include "chrome/browser/safe_browsing/malware_details.h" |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 prefs::kSafeBrowsingExtendedReportingEnabled)); | 703 prefs::kSafeBrowsingExtendedReportingEnabled)); |
704 | 704 |
705 // Simulate the user uncheck the report agreement checkbox. | 705 // Simulate the user uncheck the report agreement checkbox. |
706 sb_interstitial->SetReportingPreference(false); | 706 sb_interstitial->SetReportingPreference(false); |
707 | 707 |
708 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( | 708 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( |
709 prefs::kSafeBrowsingExtendedReportingEnabled)); | 709 prefs::kSafeBrowsingExtendedReportingEnabled)); |
710 } | 710 } |
711 | 711 |
712 // Test that the transition from old to new preference works. | 712 // Test that the transition from old to new preference works. |
713 TYPED_TEST(SafeBrowsingBlockingPageTest, | 713 TYPED_TEST(SafeBrowsingBlockingPageTest, MalwareReportsTransitionEnabled) { |
714 DISABLED_MalwareReportsTransitionEnabled) { | |
715 // The old pref is enabled. | 714 // The old pref is enabled. |
716 Profile* profile = Profile::FromBrowserContext( | 715 Profile* profile = Profile::FromBrowserContext( |
717 this->web_contents()->GetBrowserContext()); | 716 this->web_contents()->GetBrowserContext()); |
718 profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); | 717 profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); |
719 | 718 |
720 // Start a load. | 719 // Start a load. |
721 this->controller().LoadURL(GURL(kBadURL), content::Referrer(), | 720 this->controller().LoadURL(GURL(kBadURL), content::Referrer(), |
722 content::PAGE_TRANSITION_TYPED, std::string()); | 721 content::PAGE_TRANSITION_TYPED, std::string()); |
723 | 722 |
724 // Simulate the load causing a safe browsing interstitial to be shown. | 723 // Simulate the load causing a safe browsing interstitial to be shown. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 this->ProceedThroughInterstitial(sb_interstitial); | 770 this->ProceedThroughInterstitial(sb_interstitial); |
772 | 771 |
773 // The new pref is turned off. | 772 // The new pref is turned off. |
774 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( | 773 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( |
775 prefs::kSafeBrowsingExtendedReportingEnabled)); | 774 prefs::kSafeBrowsingExtendedReportingEnabled)); |
776 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( | 775 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( |
777 prefs::kSafeBrowsingReportingEnabled)); | 776 prefs::kSafeBrowsingReportingEnabled)); |
778 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( | 777 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( |
779 prefs::kSafeBrowsingDownloadFeedbackEnabled)); | 778 prefs::kSafeBrowsingDownloadFeedbackEnabled)); |
780 } | 779 } |
OLD | NEW |