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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc

Issue 55323002: Fix tests that were setting safebrowsing factories without unsetting them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/safe_browsing/database_manager_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list> 5 #include <list>
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 OK, 119 OK,
120 CANCEL 120 CANCEL
121 }; 121 };
122 122
123 SafeBrowsingBlockingPageTest() { 123 SafeBrowsingBlockingPageTest() {
124 ResetUserResponse(); 124 ResetUserResponse();
125 // The safe browsing UI manager does not need a service for this test. 125 // The safe browsing UI manager does not need a service for this test.
126 ui_manager_ = new TestSafeBrowsingUIManager(NULL); 126 ui_manager_ = new TestSafeBrowsingUIManager(NULL);
127 } 127 }
128 128
129 virtual void SetUp() { 129 virtual void SetUp() OVERRIDE {
130 ChromeRenderViewHostTestHarness::SetUp(); 130 ChromeRenderViewHostTestHarness::SetUp();
131 SafeBrowsingBlockingPage::RegisterFactory(&factory_); 131 SafeBrowsingBlockingPage::RegisterFactory(&factory_);
132 MalwareDetails::RegisterFactory(NULL); // Create it fresh each time.
133 ResetUserResponse(); 132 ResetUserResponse();
134 } 133 }
135 134
136 virtual void TearDown() { 135 virtual void TearDown() OVERRIDE {
137 // Release the UI manager before the BrowserThreads are destroyed. 136 // Release the UI manager before the BrowserThreads are destroyed.
138 ui_manager_ = NULL; 137 ui_manager_ = NULL;
138 SafeBrowsingBlockingPage::RegisterFactory(NULL);
139 // Clean up singleton reference (crbug.com/110594).
140 MalwareDetails::RegisterFactory(NULL);
139 ChromeRenderViewHostTestHarness::TearDown(); 141 ChromeRenderViewHostTestHarness::TearDown();
140 } 142 }
141 143
142 void OnBlockingPageComplete(bool proceed) { 144 void OnBlockingPageComplete(bool proceed) {
143 if (proceed) 145 if (proceed)
144 user_response_ = OK; 146 user_response_ = OK;
145 else 147 else
146 user_response_ = CANCEL; 148 user_response_ = CANCEL;
147 } 149 }
148 150
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 660
659 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( 661 EXPECT_TRUE(profile->GetPrefs()->GetBoolean(
660 prefs::kSafeBrowsingReportingEnabled)); 662 prefs::kSafeBrowsingReportingEnabled));
661 663
662 // Simulate the user uncheck the report agreement checkbox. 664 // Simulate the user uncheck the report agreement checkbox.
663 sb_interstitial->SetReportingPreference(false); 665 sb_interstitial->SetReportingPreference(false);
664 666
665 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( 667 EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
666 prefs::kSafeBrowsingReportingEnabled)); 668 prefs::kSafeBrowsingReportingEnabled));
667 } 669 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/database_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698