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

Side by Side Diff: chrome/test/testing_profile.cc

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespaces + fixes for trybot Created 10 years 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
« chrome/test/testing_profile.h ('K') | « chrome/test/testing_profile.h ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_profile.h" 5 #include "chrome/test/testing_profile.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
24 #include "chrome/browser/geolocation/geolocation_permission_context.h" 24 #include "chrome/browser/geolocation/geolocation_permission_context.h"
25 #include "chrome/browser/history/history.h" 25 #include "chrome/browser/history/history.h"
26 #include "chrome/browser/history/history_backend.h" 26 #include "chrome/browser/history/history_backend.h"
27 #include "chrome/browser/history/top_sites.h" 27 #include "chrome/browser/history/top_sites.h"
28 #include "chrome/browser/in_process_webkit/webkit_context.h" 28 #include "chrome/browser/in_process_webkit/webkit_context.h"
29 #include "chrome/browser/net/gaia/token_service.h" 29 #include "chrome/browser/net/gaia/token_service.h"
30 #include "chrome/browser/net/pref_proxy_config_service.h" 30 #include "chrome/browser/net/pref_proxy_config_service.h"
31 #include "chrome/browser/notifications/desktop_notification_service.h" 31 #include "chrome/browser/notifications/desktop_notification_service.h"
32 #include "chrome/browser/prefs/browser_prefs.h" 32 #include "chrome/browser/prefs/browser_prefs.h"
33 #include "chrome/browser/prefs/testing_pref_store.h"
33 #include "chrome/browser/search_engines/template_url_fetcher.h" 34 #include "chrome/browser/search_engines/template_url_fetcher.h"
34 #include "chrome/browser/search_engines/template_url_model.h" 35 #include "chrome/browser/search_engines/template_url_model.h"
35 #include "chrome/browser/sessions/session_service.h" 36 #include "chrome/browser/sessions/session_service.h"
36 #include "chrome/browser/sync/profile_sync_service_mock.h" 37 #include "chrome/browser/sync/profile_sync_service_mock.h"
37 #include "chrome/browser/themes/browser_theme_provider.h" 38 #include "chrome/browser/themes/browser_theme_provider.h"
38 #include "chrome/browser/ui/find_bar/find_bar_state.h" 39 #include "chrome/browser/ui/find_bar/find_bar_state.h"
39 #include "chrome/common/chrome_constants.h" 40 #include "chrome/common/chrome_constants.h"
40 #include "chrome/common/net/url_request_context_getter.h" 41 #include "chrome/common/net/url_request_context_getter.h"
41 #include "chrome/common/notification_service.h" 42 #include "chrome/common/notification_service.h"
42 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
43 #include "chrome/test/testing_pref_service.h" 44 #include "chrome/test/testing_pref_service.h"
44 #include "chrome/test/test_url_request_context_getter.h" 45 #include "chrome/test/test_url_request_context_getter.h"
45 #include "chrome/test/ui_test_utils.h" 46 #include "chrome/test/ui_test_utils.h"
46 #include "net/base/cookie_monster.h" 47 #include "net/base/cookie_monster.h"
47 #include "net/url_request/url_request_context.h" 48 #include "net/url_request/url_request_context.h"
48 #include "net/url_request/url_request_unittest.h" 49 #include "net/url_request/url_request_unittest.h"
49 #include "testing/gmock/include/gmock/gmock.h" 50 #include "testing/gmock/include/gmock/gmock.h"
50 #include "webkit/database/database_tracker.h" 51 #include "webkit/database/database_tracker.h"
51
52 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) 52 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
53 #include "chrome/browser/gtk/gtk_theme_provider.h" 53 #include "chrome/browser/gtk/gtk_theme_provider.h"
54 #endif 54 #endif
55 55
56 using base::Time; 56 using base::Time;
57 using testing::NiceMock; 57 using testing::NiceMock;
58 using testing::Return; 58 using testing::Return;
59 59
60 namespace { 60 namespace {
61 61
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) { 323 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) {
324 theme_provider->Init(this); 324 theme_provider->Init(this);
325 created_theme_provider_ = true; 325 created_theme_provider_ = true;
326 theme_provider_.reset(theme_provider); 326 theme_provider_.reset(theme_provider);
327 } 327 }
328 328
329 scoped_refptr<ExtensionService> TestingProfile::CreateExtensionService( 329 scoped_refptr<ExtensionService> TestingProfile::CreateExtensionService(
330 const CommandLine* command_line, 330 const CommandLine* command_line,
331 const FilePath& install_directory) { 331 const FilePath& install_directory) {
332 extension_pref_store_.reset(new ExtensionPrefStore); 332 // Extension pref store, created for use by |extension_prefs_|.
333 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(), 333 scoped_refptr<ExtensionPrefStore> extension_pref_store = NULL;
334 install_directory, 334 scoped_refptr<ExtensionPrefStore> incognito_extension_pref_store;
335 extension_pref_store_.get())); 335
336 if (testing_prefs_) {
Mattias Nissler (ping if slow) 2010/12/20 14:50:02 Why this conditional? GetPrefs() should suffice.
battre 2010/12/21 18:51:59 Some mock classes derived from TestingProfile do n
337 extension_pref_store = testing_prefs_->GetExtensionPrefs();
338 incognito_extension_pref_store = new ExtensionPrefStore;
339 incognito_prefs_.reset(
340 GetPrefs()->CreateIncognitoPrefService(incognito_extension_pref_store));
341 }
342 extension_prefs_.reset(
343 new ExtensionPrefs(GetPrefs(),
344 incognito_prefs_.get(),
345 install_directory,
346 extension_pref_store,
347 incognito_extension_pref_store));
336 extensions_service_ = new ExtensionService(this, 348 extensions_service_ = new ExtensionService(this,
337 command_line, 349 command_line,
338 install_directory, 350 install_directory,
339 extension_prefs_.get(), 351 extension_prefs_.get(),
340 false); 352 false);
341 return extensions_service_; 353 return extensions_service_;
342 } 354 }
343 355
344 FilePath TestingProfile::GetPath() { 356 FilePath TestingProfile::GetPath() {
345 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. 357 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better.
346 return temp_dir_.path(); 358 return temp_dir_.path();
347 } 359 }
348 360
349 TestingPrefService* TestingProfile::GetTestingPrefService() { 361 TestingPrefService* TestingProfile::GetTestingPrefService() {
350 if (!prefs_.get()) 362 if (!prefs_.get())
(...skipping 30 matching lines...) Expand all
381 } 393 }
382 } 394 }
383 395
384 void TestingProfile::SetPrefService(PrefService* prefs) { 396 void TestingProfile::SetPrefService(PrefService* prefs) {
385 DCHECK(!prefs_.get()); 397 DCHECK(!prefs_.get());
386 prefs_.reset(prefs); 398 prefs_.reset(prefs);
387 } 399 }
388 400
389 void TestingProfile::CreateTestingPrefService() { 401 void TestingProfile::CreateTestingPrefService() {
390 DCHECK(!prefs_.get()); 402 DCHECK(!prefs_.get());
391 testing_prefs_ = new TestingPrefService(); 403 testing_prefs_ = TestingPrefService::CreateTestingPrefService();
392 prefs_.reset(testing_prefs_); 404 prefs_.reset(testing_prefs_);
393 Profile::RegisterUserPrefs(prefs_.get()); 405 Profile::RegisterUserPrefs(prefs_.get());
394 browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); 406 browser::RegisterAllPrefs(prefs_.get(), prefs_.get());
395 } 407 }
396 408
397 PrefService* TestingProfile::GetPrefs() { 409 PrefService* TestingProfile::GetPrefs() {
398 if (!prefs_.get()) { 410 if (!prefs_.get()) {
399 CreateTestingPrefService(); 411 CreateTestingPrefService();
400 } 412 }
401 return prefs_.get(); 413 return prefs_.get();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 529 }
518 return profile_sync_service_.get(); 530 return profile_sync_service_.get();
519 } 531 }
520 532
521 void TestingProfile::DestroyWebDataService() { 533 void TestingProfile::DestroyWebDataService() {
522 if (!web_data_service_.get()) 534 if (!web_data_service_.get())
523 return; 535 return;
524 536
525 web_data_service_->Shutdown(); 537 web_data_service_->Shutdown();
526 } 538 }
OLDNEW
« chrome/test/testing_profile.h ('K') | « chrome/test/testing_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698