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

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

Issue 5102001: Add a checkbox to the malware interstitial page, for user to opt-in to send m... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
Index: chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc (revision 66339)
+++ chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc (working copy)
@@ -5,9 +5,12 @@
#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/test_tab_contents.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
@@ -390,8 +393,7 @@
EXPECT_EQ(kBadURL, controller().GetActiveEntry()->url().spec());
}
-// Tests that calling "don't proceed" after "proceed" has been called doesn't
-// cause problems. http://crbug.com/30079
+//
TEST_F(SafeBrowsingBlockingPageTest, ProceedThenDontProceed) {
// Start a load.
controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED);
@@ -415,3 +417,35 @@
EXPECT_EQ(OK, user_response());
EXPECT_FALSE(GetSafeBrowsingBlockingPage());
}
+
+// 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));
+}

Powered by Google App Engine
This is Rietveld 408576698