summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-20 17:38:39 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-20 17:38:39 +0000
commit55eb70e76bd17909cc5202c5a9af3e1c886989e4 (patch)
tree9ea8a13b9f9e1ab0297ea0ff79093dc4c5ad20d0 /chrome/browser/safe_browsing
parent7edf30319847892be800a0127fee985a24050166 (diff)
downloadchromium_src-55eb70e76bd17909cc5202c5a9af3e1c886989e4.zip
chromium_src-55eb70e76bd17909cc5202c5a9af3e1c886989e4.tar.gz
chromium_src-55eb70e76bd17909cc5202c5a9af3e1c886989e4.tar.bz2
Move creation of BrowserContext objects that live in content to content, instead of depending on the embedder. Apart from allowing us to hide more of content from embedders, it simplifies the work that every embedder has to do (see the change the shell_browser_context.cc as an example).
BUG=98716 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=122521 Review URL: https://chromiumcodereview.appspot.com/9419033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host_unittest.cc18
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc3
2 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index ff85fac..0b101f8 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -5,6 +5,7 @@
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/safe_browsing/browser_feature_extractor.h"
#include "chrome/browser/safe_browsing/client_side_detection_host.h"
#include "chrome/browser/safe_browsing/client_side_detection_service.h"
@@ -159,6 +160,9 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI,
&message_loop_));
+ file_user_blocking_thread_.reset(
+ new content::TestBrowserThread(BrowserThread::FILE_USER_BLOCKING,
+ &message_loop_));
// Note: we're starting a real IO thread to make sure our DCHECKs that
// verify which thread is running are actually tested.
io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO));
@@ -178,6 +182,11 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
csd_host_->browse_info_.reset(new BrowseInfo);
}
+ static void RunAllPendingOnIO(base::WaitableEvent* event) {
+ MessageLoop::current()->RunAllPending();
+ event->Signal();
+ }
+
virtual void TearDown() {
// Delete the host object on the UI thread and release the
// SafeBrowsingService.
@@ -186,7 +195,15 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
sb_service_ = NULL;
message_loop_.RunAllPending();
TabContentsWrapperTestHarness::TearDown();
+
+ // Let the tasks on the IO thread run to avoid memory leaks.
+ base::WaitableEvent done(false, false);
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(RunAllPendingOnIO, &done));
+ done.Wait();
io_thread_.reset();
+ message_loop_.RunAllPending();
+ file_user_blocking_thread_.reset();
ui_thread_.reset();
}
@@ -290,6 +307,7 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
private:
scoped_ptr<content::TestBrowserThread> ui_thread_;
+ scoped_ptr<content::TestBrowserThread> file_user_blocking_thread_;
scoped_ptr<content::TestBrowserThread> io_thread_;
};
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
index 139a643..7a366bc 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -82,6 +82,8 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness {
SafeBrowsingBlockingPageTest()
: ui_thread_(BrowserThread::UI, MessageLoop::current()),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()),
io_thread_(BrowserThread::IO, MessageLoop::current()) {
ResetUserResponse();
service_ = new TestSafeBrowsingService();
@@ -189,6 +191,7 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness {
UserResponse user_response_;
TestSafeBrowsingBlockingPageFactory factory_;
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
};