OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 5 |
6 #include "chrome/browser/prefs/pref_service.h" | 6 #include "chrome/browser/prefs/pref_service.h" |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/safe_browsing/malware_details.h" | 8 #include "chrome/browser/safe_browsing/malware_details.h" |
9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 ResetUserResponse(); | 83 ResetUserResponse(); |
84 service_ = new TestSafeBrowsingService(); | 84 service_ = new TestSafeBrowsingService(); |
85 } | 85 } |
86 | 86 |
87 virtual void SetUp() { | 87 virtual void SetUp() { |
88 ChromeRenderViewHostTestHarness::SetUp(); | 88 ChromeRenderViewHostTestHarness::SetUp(); |
89 SafeBrowsingBlockingPage::RegisterFactory(&factory_); | 89 SafeBrowsingBlockingPage::RegisterFactory(&factory_); |
90 ResetUserResponse(); | 90 ResetUserResponse(); |
91 } | 91 } |
92 | 92 |
| 93 virtual void TearDown() { |
| 94 // Release the SafeBrowsingService before the BrowserThreads are destroyed. |
| 95 service_ = NULL; |
| 96 ChromeRenderViewHostTestHarness::TearDown(); |
| 97 } |
| 98 |
93 // SafeBrowsingService::Client implementation. | 99 // SafeBrowsingService::Client implementation. |
94 virtual void OnUrlCheckResult(const GURL& url, | 100 virtual void OnUrlCheckResult(const GURL& url, |
95 SafeBrowsingService::UrlCheckResult result) { | 101 SafeBrowsingService::UrlCheckResult result) { |
96 } | 102 } |
97 virtual void OnBlockingPageComplete(bool proceed) { | 103 virtual void OnBlockingPageComplete(bool proceed) { |
98 if (proceed) | 104 if (proceed) |
99 user_response_ = OK; | 105 user_response_ = OK; |
100 else | 106 else |
101 user_response_ = CANCEL; | 107 user_response_ = CANCEL; |
102 } | 108 } |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 592 |
587 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( | 593 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( |
588 prefs::kSafeBrowsingReportingEnabled)); | 594 prefs::kSafeBrowsingReportingEnabled)); |
589 | 595 |
590 // Simulate the user uncheck the report agreement checkbox. | 596 // Simulate the user uncheck the report agreement checkbox. |
591 sb_interstitial->SetReportingPreference(false); | 597 sb_interstitial->SetReportingPreference(false); |
592 | 598 |
593 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( | 599 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( |
594 prefs::kSafeBrowsingReportingEnabled)); | 600 prefs::kSafeBrowsingReportingEnabled)); |
595 } | 601 } |
OLD | NEW |