summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing/protocol_manager_unittest.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 20:52:56 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 20:52:56 +0000
commitd11f566be9d149ea081607d0dbb12be7aebb4de6 (patch)
tree14fad2b08a19246ee3d223d61b67b23b8d241e38 /chrome/browser/safe_browsing/protocol_manager_unittest.cc
parent7520d82219786cae7484e4a9ca5e80879d56e036 (diff)
downloadchromium_src-d11f566be9d149ea081607d0dbb12be7aebb4de6.zip
chromium_src-d11f566be9d149ea081607d0dbb12be7aebb4de6.tar.gz
chromium_src-d11f566be9d149ea081607d0dbb12be7aebb4de6.tar.bz2
Fix a crash during shutdown where SafeBrowsingProtocolManager could end up getting back NULL for Profile::GetDefaultRequestContext() and consequently URLFetcher would crash.
During shutdown the Profile is first deleted, and THEN the IO thread is torn down. This means there is a window of time when Profile::GetDefaultRequestContext() will return NULL, but tasks are still running on the IO thread. Instead, SafeBrowsingProtocolManager now gets passed an explicit context, and holds a reference throughout its lifetime. This way it is guaranteed a valid pointer throughout the lifetime of the IO thread, even if the default Profile has already been deleted. BUG=27074 Review URL: http://codereview.chromium.org/392010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31821 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/protocol_manager_unittest.cc')
-rw-r--r--chrome/browser/safe_browsing/protocol_manager_unittest.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
index 2330a68..e8d64d0 100644
--- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
@@ -16,7 +16,7 @@ class SafeBrowsingProtocolManagerTest : public testing::Test {
// Ensure that we respect section 5 of the SafeBrowsing protocol specification.
TEST_F(SafeBrowsingProtocolManagerTest, TestBackOffTimes) {
- SafeBrowsingProtocolManager pm(NULL, "", "", "");
+ SafeBrowsingProtocolManager pm(NULL, "", "", "", NULL);
pm.next_update_sec_ = 1800;
DCHECK(pm.back_off_fuzz_ >= 0.0 && pm.back_off_fuzz_ <= 1.0);
@@ -54,7 +54,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, TestBackOffTimes) {
// Test string combinations with and without MAC.
TEST_F(SafeBrowsingProtocolManagerTest, TestChunkStrings) {
- SafeBrowsingProtocolManager pm(NULL, "", "", "");
+ SafeBrowsingProtocolManager pm(NULL, "", "", "", NULL);
// Add and Sub chunks.
SBListChunkRanges phish("goog-phish-shavar");
@@ -87,7 +87,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, TestChunkStrings) {
}
TEST_F(SafeBrowsingProtocolManagerTest, TestGetHashBackOffTimes) {
- SafeBrowsingProtocolManager pm(NULL, "", "", "");
+ SafeBrowsingProtocolManager pm(NULL, "", "", "", NULL);
// No errors or back off time yet.
EXPECT_EQ(pm.gethash_error_count_, 0);