OLD | NEW |
---|---|
1 // Copyright (c) 2010 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_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" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 void TestingProfile::SetTemplateURLModel(TemplateURLModel* model) { | 319 void TestingProfile::SetTemplateURLModel(TemplateURLModel* model) { |
320 template_url_model_.reset(model); | 320 template_url_model_.reset(model); |
321 } | 321 } |
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 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 ExtensionPrefStore* extension_pref_store = NULL; |
334 install_directory, | 334 ExtensionPrefStore* incognito_extension_pref_store = NULL; |
335 extension_pref_store_.get())); | 335 |
336 if (testing_prefs_) { | |
Mattias Nissler (ping if slow)
2011/01/05 12:08:07
If have commented this before, just use GetPrefs()
battre
2011/01/05 20:23:08
I have commented this as well. ;-)
See http://code
| |
337 extension_pref_store = testing_prefs_->GetExtensionPrefs(); | |
338 incognito_extension_pref_store = new ExtensionPrefStore(true); | |
339 } | |
340 extension_prefs_.reset( | |
341 new ExtensionPrefs(GetPrefs(), | |
342 install_directory, | |
343 extension_pref_store, | |
344 incognito_extension_pref_store)); | |
336 extensions_service_ = new ExtensionService(this, | 345 extensions_service_ = new ExtensionService(this, |
337 command_line, | 346 command_line, |
338 install_directory, | 347 install_directory, |
339 extension_prefs_.get(), | 348 extension_prefs_.get(), |
340 false); | 349 false); |
341 return extensions_service_; | 350 return extensions_service_; |
342 } | 351 } |
343 | 352 |
344 FilePath TestingProfile::GetPath() { | 353 FilePath TestingProfile::GetPath() { |
345 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. | 354 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. |
346 return temp_dir_.path(); | 355 return temp_dir_.path(); |
347 } | 356 } |
348 | 357 |
349 TestingPrefService* TestingProfile::GetTestingPrefService() { | 358 TestingPrefService* TestingProfile::GetTestingPrefService() { |
350 if (!prefs_.get()) | 359 if (!prefs_.get()) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 } | 526 } |
518 return profile_sync_service_.get(); | 527 return profile_sync_service_.get(); |
519 } | 528 } |
520 | 529 |
521 void TestingProfile::DestroyWebDataService() { | 530 void TestingProfile::DestroyWebDataService() { |
522 if (!web_data_service_.get()) | 531 if (!web_data_service_.get()) |
523 return; | 532 return; |
524 | 533 |
525 web_data_service_->Shutdown(); | 534 web_data_service_->Shutdown(); |
526 } | 535 } |
OLD | NEW |