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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/test/testing_browser_process.h" 5 #include "chrome/test/testing_browser_process.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "chrome/browser/google/google_url_tracker.h" 9 #include "chrome/browser/google/google_url_tracker.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 void TestingBrowserProcess::SetPrefService(PrefService* pref_service) { 187 void TestingBrowserProcess::SetPrefService(PrefService* pref_service) {
188 pref_service_ = pref_service; 188 pref_service_ = pref_service;
189 } 189 }
190 190
191 void TestingBrowserProcess::SetGoogleURLTracker( 191 void TestingBrowserProcess::SetGoogleURLTracker(
192 GoogleURLTracker* google_url_tracker) { 192 GoogleURLTracker* google_url_tracker) {
193 google_url_tracker_.reset(google_url_tracker); 193 google_url_tracker_.reset(google_url_tracker);
194 } 194 }
195
196 ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() {
197 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062.
198 // ChromeTestSuite sets up a global TestingBrowserProcess
199 // for all tests. We need to get rid of it, because it contains
200 // a NotificationService, and there can be only one NotificationService
201 // per thread.
202 DCHECK(g_browser_process);
203 delete g_browser_process;
204
205 browser_process_.reset(new TestingBrowserProcess);
206 g_browser_process = browser_process_.get();
207 }
208
209 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() {
210 DCHECK_EQ(browser_process_.get(), g_browser_process);
211
212 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062.
213 // After the transition is over, we should just
214 // reset |g_browser_process| to NULL.
215 browser_process_.reset();
216 g_browser_process = new TestingBrowserProcess();
217 }
OLDNEW
« 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