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

Unified Diff: chrome/test/testing_browser_process.cc

Issue 6478005: GTTF: Use a fresh TestingBrowserProcess for each test, part #1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make more tests use the new base class Created 9 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/testing_browser_process.h ('k') | chrome/test/testing_browser_process_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/testing_browser_process.cc
diff --git a/chrome/test/testing_browser_process.cc b/chrome/test/testing_browser_process.cc
index 004ac87def5f66708b07eb864f995a173c573e74..4d50fa4737b7bc5b23075686955d7dfa41c69015 100644
--- a/chrome/test/testing_browser_process.cc
+++ b/chrome/test/testing_browser_process.cc
@@ -192,3 +192,26 @@ void TestingBrowserProcess::SetGoogleURLTracker(
GoogleURLTracker* google_url_tracker) {
google_url_tracker_.reset(google_url_tracker);
}
+
+ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() {
+ // TODO(phajdan.jr): Temporary, for http://crbug.com/61062.
+ // ChromeTestSuite sets up a global TestingBrowserProcess
+ // for all tests. We need to get rid of it, because it contains
+ // a NotificationService, and there can be only one NotificationService
+ // per thread.
+ DCHECK(g_browser_process);
+ delete g_browser_process;
+
+ browser_process_.reset(new TestingBrowserProcess);
+ g_browser_process = browser_process_.get();
+}
+
+ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() {
+ DCHECK_EQ(browser_process_.get(), g_browser_process);
+
+ // TODO(phajdan.jr): Temporary, for http://crbug.com/61062.
+ // After the transition is over, we should just
+ // reset |g_browser_process| to NULL.
+ browser_process_.reset();
+ g_browser_process = new TestingBrowserProcess();
+}
« no previous file with comments | « chrome/test/testing_browser_process.h ('k') | chrome/test/testing_browser_process_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698