Chromium Code Reviews| 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()); |
| } |
| + |
|
lzheng
2010/11/19 18:50:47
I've pinged Panayiotis that we should have a Brows
kewang
2010/11/20 00:45:51
Yes, Panos and I worked on it this afternoon and h
|
| +// 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)); |
| +} |