Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc

Issue 6066011: Add a checkbox to the malware interstitial page, for user to opt-in to send m... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc (revision 70746)
+++ chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc (working copy)
@@ -548,3 +548,35 @@
EXPECT_EQ(0u, service_->GetDetails()->size());
service_->GetDetails()->clear();
}
+
+// Test setting the malware report preferance
+TEST_F(SafeBrowsingBlockingPageTest, MalwareReports) {
+ // Disable malware reports.
+ contents()->profile()->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingReportingEnabled, false);
+
+ // Start a load.
+ controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED);
+
+ // Simulate the load causing a safe browsing interstitial to be shown.
+ ShowInterstitial(ResourceType::MAIN_FRAME, kBadURL);
+ SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
+ ASSERT_TRUE(sb_interstitial);
+
+ MessageLoop::current()->RunAllPending();
+
+ EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingReportingEnabled));
+
+ // Simulate the user check the report agreement checkbox.
+ sb_interstitial->SetReportingPreference(true);
+
+ EXPECT_TRUE(contents()->profile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingReportingEnabled));
+
+ // Simulate the user uncheck the report agreement checkbox.
+ sb_interstitial->SetReportingPreference(false);
+
+ EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingReportingEnabled));
+}
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698