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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer_host/test/test_render_view_host.h" 5 #include "chrome/browser/renderer_host/test/test_render_view_host.h"
6 6
7 #include "chrome/browser/browser_thread.h" 7 #include "chrome/browser/browser_thread.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 EXPECT_EQ(CANCEL, user_response()); 541 EXPECT_EQ(CANCEL, user_response());
542 EXPECT_FALSE(GetSafeBrowsingBlockingPage()); 542 EXPECT_FALSE(GetSafeBrowsingBlockingPage());
543 543
544 // We did not proceed, the pending entry should be gone. 544 // We did not proceed, the pending entry should be gone.
545 EXPECT_FALSE(controller().pending_entry()); 545 EXPECT_FALSE(controller().pending_entry());
546 546
547 // No report should have been sent. 547 // No report should have been sent.
548 EXPECT_EQ(0u, service_->GetDetails()->size()); 548 EXPECT_EQ(0u, service_->GetDetails()->size());
549 service_->GetDetails()->clear(); 549 service_->GetDetails()->clear();
550 } 550 }
551
552 // Test setting the malware report preferance
553 TEST_F(SafeBrowsingBlockingPageTest, MalwareReports) {
554 // Disable malware reports.
555 contents()->profile()->GetPrefs()->SetBoolean(
556 prefs::kSafeBrowsingReportingEnabled, false);
557
558 // Start a load.
559 controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED);
560
561 // Simulate the load causing a safe browsing interstitial to be shown.
562 ShowInterstitial(ResourceType::MAIN_FRAME, kBadURL);
563 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
564 ASSERT_TRUE(sb_interstitial);
565
566 MessageLoop::current()->RunAllPending();
567
568 EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean(
569 prefs::kSafeBrowsingReportingEnabled));
570
571 // Simulate the user check the report agreement checkbox.
572 sb_interstitial->SetReportingPreference(true);
573
574 EXPECT_TRUE(contents()->profile()->GetPrefs()->GetBoolean(
575 prefs::kSafeBrowsingReportingEnabled));
576
577 // Simulate the user uncheck the report agreement checkbox.
578 sb_interstitial->SetReportingPreference(false);
579
580 EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean(
581 prefs::kSafeBrowsingReportingEnabled));
582 }
OLDNEW
« 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