diff options
58 files changed, 240 insertions, 105 deletions
diff --git a/chrome/browser/autocomplete/history_contents_provider_unittest.cc b/chrome/browser/autocomplete/history_contents_provider_unittest.cc index 2fd6e23..124a9a2 100644 --- a/chrome/browser/autocomplete/history_contents_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_contents_provider_unittest.cc @@ -5,8 +5,10 @@ #include "base/file_util.h" #include "base/path_service.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/history_contents_provider.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/history/history.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc index 845d2e7..d3ab9c3 100644 --- a/chrome/browser/autocomplete/history_url_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc @@ -6,6 +6,7 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/history_url_provider.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/history/history.h" diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index f4e46238..4001d35 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -6,7 +6,10 @@ #include "app/tree_node_iterator.h" #include "app/tree_node_model.h" +#include "base/base_paths.h" +#include "base/file_util.h" #include "base/hash_tables.h" +#include "base/path_service.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_codec.h" diff --git a/chrome/browser/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data_database_helper_browsertest.cc index 85792eb..081d5a0 100644 --- a/chrome/browser/browsing_data_database_helper_browsertest.cc +++ b/chrome/browser/browsing_data_database_helper_browsertest.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/file_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browsing_data_database_helper.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/testing_profile.h" #include "chrome/test/ui_test_utils.h" diff --git a/chrome/browser/browsing_data_database_helper_unittest.cc b/chrome/browser/browsing_data_database_helper_unittest.cc index 5280dd8..c8f1c18 100644 --- a/chrome/browser/browsing_data_database_helper_unittest.cc +++ b/chrome/browser/browsing_data_database_helper_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/browsing_data_database_helper.h" +#include "base/file_util.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/browsing_data_local_storage_helper_browsertest.cc b/chrome/browser/browsing_data_local_storage_helper_browsertest.cc index e98c5f1..2e6e79d 100644 --- a/chrome/browser/browsing_data_local_storage_helper_browsertest.cc +++ b/chrome/browser/browsing_data_local_storage_helper_browsertest.cc @@ -7,6 +7,7 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/file_path.h" +#include "base/file_util.h" #include "base/ref_counted.h" #include "chrome/browser/in_process_webkit/webkit_context.h" #include "chrome/browser/in_process_webkit/webkit_thread.h" diff --git a/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h b/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h index c3d6e83..d35d1e9 100644 --- a/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h +++ b/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h @@ -17,6 +17,8 @@ #include "chrome/test/model_test_utils.h" #include "testing/platform_test.h" +class BookmarkModel; + // The fake object that acts as our app's delegate, useful for testing purposes. @interface FakeAppDelegate : AppController { @public @@ -39,24 +41,13 @@ // The base class for all our bookmark releated unit tests. class BookmarkAppleScriptTest : public CocoaTest { public: - BookmarkAppleScriptTest() { - appDelegate_.reset([[FakeAppDelegate alloc] init]); - [appDelegate_.get() setHelper:&helper_]; - [NSApp setDelegate:appDelegate_]; - const BookmarkNode* root = model().GetBookmarkBarNode(); - const std::wstring modelString(L"a f1:[ b d c ] d f2:[ e f g ] h "); - model_test_utils::AddNodesFromModelString(model(), root, modelString); - bookmarkBar_.reset([[BookmarkFolderAppleScript alloc] - initWithBookmarkNode:model().GetBookmarkBarNode()]); - } + BookmarkAppleScriptTest(); private: BrowserTestHelper helper_; scoped_nsobject<FakeAppDelegate> appDelegate_; protected: scoped_nsobject<BookmarkFolderAppleScript> bookmarkBar_; - BookmarkModel& model() { - return *helper_.profile()->GetBookmarkModel(); - } + BookmarkModel& model(); }; #endif diff --git a/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.mm b/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.mm index 5616774..3323dc7 100644 --- a/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.mm +++ b/chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.mm @@ -4,6 +4,8 @@ #import "chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h" +#include "chrome/browser/bookmarks/bookmark_model.h" + @implementation FakeAppDelegate @synthesize helper = helper_; @@ -43,3 +45,18 @@ static FakeScriptCommand* kFakeCurrentCommand; } @end + +BookmarkAppleScriptTest::BookmarkAppleScriptTest() { + appDelegate_.reset([[FakeAppDelegate alloc] init]); + [appDelegate_.get() setHelper:&helper_]; + [NSApp setDelegate:appDelegate_]; + const BookmarkNode* root = model().GetBookmarkBarNode(); + const std::wstring modelString(L"a f1:[ b d c ] d f2:[ e f g ] h "); + model_test_utils::AddNodesFromModelString(model(), root, modelString); + bookmarkBar_.reset([[BookmarkFolderAppleScript alloc] + initWithBookmarkNode:model().GetBookmarkBarNode()]); +} + +BookmarkModel& BookmarkAppleScriptTest::model() { + return *helper_.profile()->GetBookmarkModel(); +} diff --git a/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm b/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm index 48dd371..f562f56 100644 --- a/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm @@ -6,6 +6,7 @@ #include "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_all_tabs_controller.h" #include "chrome/browser/cocoa/browser_test_helper.h" #import "chrome/browser/cocoa/cocoa_test_helper.h" diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 6b90940..a0491a2 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -9,6 +9,7 @@ #include "base/scoped_nsobject.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_bar_constants.h" #import "chrome/browser/cocoa/bookmark_bar_controller.h" #import "chrome/browser/cocoa/bookmark_bar_folder_window.h" diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm index 0b94654..555a3c9 100644 --- a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm @@ -6,6 +6,7 @@ #include "base/basictypes.h" #include "base/scoped_nsobject.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_bar_constants.h" // namespace bookmarks #import "chrome/browser/cocoa/bookmark_bar_controller.h" #import "chrome/browser/cocoa/bookmark_bar_folder_button_cell.h" diff --git a/chrome/browser/cocoa/bookmark_button_cell_unittest.mm b/chrome/browser/cocoa/bookmark_button_cell_unittest.mm index a665a48..8f93c69 100644 --- a/chrome/browser/cocoa/bookmark_button_cell_unittest.mm +++ b/chrome/browser/cocoa/bookmark_button_cell_unittest.mm @@ -4,6 +4,7 @@ #include "app/resource_bundle.h" #include "base/scoped_nsobject.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_button_cell.h" #import "chrome/browser/cocoa/bookmark_menu.h" #include "chrome/browser/cocoa/browser_test_helper.h" diff --git a/chrome/browser/cocoa/bookmark_button_unittest.mm b/chrome/browser/cocoa/bookmark_button_unittest.mm index bd0f89e..261dbf7 100644 --- a/chrome/browser/cocoa/bookmark_button_unittest.mm +++ b/chrome/browser/cocoa/bookmark_button_unittest.mm @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/scoped_nsobject.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_button.h" #import "chrome/browser/cocoa/bookmark_button_cell.h" #import "chrome/browser/cocoa/browser_test_helper.h" diff --git a/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm b/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm index 1a0d35b..2550aec 100644 --- a/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm @@ -7,6 +7,7 @@ #include "app/l10n_util_mac.h" #include "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_editor_controller.h" #include "chrome/browser/cocoa/browser_test_helper.h" #import "chrome/browser/cocoa/cocoa_test_helper.h" diff --git a/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm b/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm index 8d0858b..57b583c 100644 --- a/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm @@ -5,6 +5,7 @@ #import <Cocoa/Cocoa.h> #include "base/sys_string_conversions.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_editor_controller.h" #include "chrome/browser/cocoa/browser_test_helper.h" #import "chrome/browser/cocoa/cocoa_test_helper.h" diff --git a/chrome/browser/cocoa/bookmark_folder_target_unittest.mm b/chrome/browser/cocoa/bookmark_folder_target_unittest.mm index 4fd01ef..22f421f 100644 --- a/chrome/browser/cocoa/bookmark_folder_target_unittest.mm +++ b/chrome/browser/cocoa/bookmark_folder_target_unittest.mm @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_bar_controller.h" #import "chrome/browser/cocoa/bookmark_bar_folder_controller.h" #import "chrome/browser/cocoa/bookmark_folder_target.h" diff --git a/chrome/browser/cocoa/bookmark_menu_bridge_unittest.mm b/chrome/browser/cocoa/bookmark_menu_bridge_unittest.mm index 2191310..4f275eb 100644 --- a/chrome/browser/cocoa/bookmark_menu_bridge_unittest.mm +++ b/chrome/browser/cocoa/bookmark_menu_bridge_unittest.mm @@ -6,6 +6,7 @@ #import "base/scoped_nsobject.h" #include "base/string_util.h" #include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser.h" #include "chrome/browser/cocoa/bookmark_menu_bridge.h" #include "chrome/browser/cocoa/browser_test_helper.h" diff --git a/chrome/browser/cocoa/bug_report_window_controller_unittest.mm b/chrome/browser/cocoa/bug_report_window_controller_unittest.mm index cf8d3ac..8dc62bf 100644 --- a/chrome/browser/cocoa/bug_report_window_controller_unittest.mm +++ b/chrome/browser/cocoa/bug_report_window_controller_unittest.mm @@ -6,6 +6,7 @@ #include "base/ref_counted.h" #import "chrome/browser/cocoa/bug_report_window_controller.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/site_instance.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/browser/tab_contents/test_tab_contents.h" diff --git a/chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm b/chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm index 3e62b96..2af7655 100644 --- a/chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm +++ b/chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm @@ -9,7 +9,9 @@ #include "chrome/browser/cocoa/browser_test_helper.h" #include "chrome/browser/cocoa/cocoa_test_helper.h" #include "chrome/browser/geolocation/geolocation_content_settings_map.h" +#include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/notifications/desktop_notification_service.h" +#include "chrome/browser/pref_service.h" #include "chrome/common/pref_names.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" diff --git a/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm b/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm index 211e53a..eeb8e25 100644 --- a/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm +++ b/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm @@ -2,10 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/message_loop.h" #include "base/sys_string_conversions.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/cocoa/cocoa_test_helper.h" #include "chrome/browser/cocoa/cookie_prompt_window_controller.h" #include "chrome/browser/cookie_modal_dialog.h" +#include "chrome/browser/host_content_settings_map.h" #include "chrome/test/testing_profile.h" // A mock class which implements just enough functionality to diff --git a/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm b/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm index 50e7259..c05803e 100644 --- a/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm +++ b/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm @@ -8,6 +8,7 @@ #include "chrome/browser/cocoa/browser_test_helper.h" #include "chrome/browser/cocoa/cocoa_test_helper.h" #import "chrome/browser/cocoa/edit_search_engine_cocoa_controller.h" +#include "chrome/browser/search_engines/template_url.h" #include "chrome/test/testing_profile.h" #include "grit/generated_resources.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/content_setting_bubble_model_unittest.cc b/chrome/browser/content_setting_bubble_model_unittest.cc index 7a77fb9..f1d908d 100644 --- a/chrome/browser/content_setting_bubble_model_unittest.cc +++ b/chrome/browser/content_setting_bubble_model_unittest.cc @@ -4,7 +4,9 @@ #include "chrome/browser/content_setting_bubble_model.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/profile.h" +#include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/browser/tab_contents/test_tab_contents.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc index d91de53..de317b6 100644 --- a/chrome/browser/cookies_tree_model_unittest.cc +++ b/chrome/browser/cookies_tree_model_unittest.cc @@ -11,6 +11,9 @@ #include "chrome/browser/mock_browsing_data_database_helper.h" #include "chrome/browser/mock_browsing_data_local_storage_helper.h" #include "chrome/common/net/url_request_context_getter.h" +#include "chrome/common/notification_details.h" +#include "chrome/common/notification_service.h" +#include "chrome/common/notification_type.h" #include "chrome/test/testing_profile.h" #include "net/url_request/url_request_context.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc index c093e1e..e3ceeef 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/ref_counted_memory.h" #include "chrome/browser/browser_theme_provider.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/dom_ui_theme_source.h" diff --git a/chrome/browser/dom_ui/dom_ui_unittest.cc b/chrome/browser/dom_ui/dom_ui_unittest.cc index 51f5e1e..ffb1870 100644 --- a/chrome/browser/dom_ui/dom_ui_unittest.cc +++ b/chrome/browser/dom_ui/dom_ui_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/new_tab_ui.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc index 39f2b41..fa9a5cba 100644 --- a/chrome/browser/download/download_manager_unittest.cc +++ b/chrome/browser/download/download_manager_unittest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/download/download_manager.h" #include "chrome/browser/download/download_util.h" #include "chrome/browser/history/download_types.h" +#include "chrome/browser/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/encoding_menu_controller_unittest.cc b/chrome/browser/encoding_menu_controller_unittest.cc index e7a7fef..70edff2 100644 --- a/chrome/browser/encoding_menu_controller_unittest.cc +++ b/chrome/browser/encoding_menu_controller_unittest.cc @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/extensions/extension_cookies_unittest.cc b/chrome/browser/extensions/extension_cookies_unittest.cc index fbc1fdc..0abbe7e 100644 --- a/chrome/browser/extensions/extension_cookies_unittest.cc +++ b/chrome/browser/extensions/extension_cookies_unittest.cc @@ -7,9 +7,11 @@ #include "testing/gtest/include/gtest/gtest.h" +#include "base/values.h" #include "chrome/browser/extensions/extension_cookies_api_constants.h" #include "chrome/browser/extensions/extension_cookies_helpers.h" #include "chrome/test/testing_profile.h" +#include "googleurl/src/gurl.h" namespace keys = extension_cookies_api_constants; diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index b3e2b0f..204d5aa 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -14,12 +14,14 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/scoped_ptr.h" +#include "base/stl_util-inl.h" #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/task.h" #include "base/utf_string_conversions.h" #include "base/version.h" +#include "chrome/browser/browser_prefs.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_creator.h" @@ -28,6 +30,8 @@ #include "chrome/browser/extensions/external_extension_provider.h" #include "chrome/browser/extensions/external_pref_extension_provider.h" #include "chrome/browser/extensions/pack_extension_job.cc" +#include "chrome/browser/in_process_webkit/webkit_context.h" +#include "chrome/browser/in_process_webkit/dom_storage_context.h" #include "chrome/browser/pref_value_store.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" @@ -36,6 +40,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/json_value_serializer.h" +#include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" @@ -43,6 +48,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/testing_profile.h" #include "googleurl/src/gurl.h" +#include "net/url_request/url_request_context.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #include "webkit/database/database_tracker.h" diff --git a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc index defba3a..aa863c5 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/geolocation/geolocation_content_settings_map.h" +#include "chrome/browser/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc index a20bc13..66d1168 100644 --- a/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc +++ b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/common/content_settings_helper.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc index b31608a..59b070f 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc @@ -5,6 +5,9 @@ #include "chrome/browser/geolocation/geolocation_permission_context.h" #include "base/scoped_vector.h" +#include "chrome/browser/chrome_thread.h" +#include "chrome/browser/geolocation/geolocation_content_settings_map.h" +#include "chrome/browser/geolocation/geolocation_permission_context.h" #include "chrome/browser/geolocation/location_arbitrator.h" #include "chrome/browser/geolocation/location_provider.h" #include "chrome/browser/geolocation/mock_location_provider.h" diff --git a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc index f001ed2..157c9b1 100644 --- a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc +++ b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/geolocation/geolocation_settings_state.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/gtk/bookmark_bar_gtk_unittest.cc b/chrome/browser/gtk/bookmark_bar_gtk_unittest.cc index 59c6172..3f9fdcf 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk_unittest.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/gtk/bookmark_bar_gtk.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/gtk/tabstrip_origin_provider.h" diff --git a/chrome/browser/gtk/gtk_theme_provider_unittest.cc b/chrome/browser/gtk/gtk_theme_provider_unittest.cc index f0d8e28..6f16d6b 100644 --- a/chrome/browser/gtk/gtk_theme_provider_unittest.cc +++ b/chrome/browser/gtk/gtk_theme_provider_unittest.cc @@ -5,6 +5,7 @@ #include <gtk/gtk.h> #include "chrome/browser/gtk/gtk_theme_provider.h" +#include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/gtk/keyword_editor_view_unittest.cc b/chrome/browser/gtk/keyword_editor_view_unittest.cc index 431a868..dccec01 100644 --- a/chrome/browser/gtk/keyword_editor_view_unittest.cc +++ b/chrome/browser/gtk/keyword_editor_view_unittest.cc @@ -10,6 +10,7 @@ #include <vector> #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/gtk/gtk_tree.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_model.h" diff --git a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc b/chrome/browser/gtk/options/languages_page_gtk_unittest.cc index cf68dbb..e75c7dd 100644 --- a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc +++ b/chrome/browser/gtk/options/languages_page_gtk_unittest.cc @@ -8,6 +8,7 @@ #include "base/string_util.h" #include "chrome/browser/language_combobox_model.h" +#include "chrome/browser/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc index d06f671..c7c2e91 100644 --- a/chrome/browser/history/top_sites_unittest.cc +++ b/chrome/browser/history/top_sites_unittest.cc @@ -3,15 +3,18 @@ // found in the LICENSE file. #include "app/l10n_util.h" +#include "base/file_util.h" #include "base/scoped_temp_dir.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "base/values.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/history/top_sites.h" -#include "chrome/common/chrome_paths.h" #include "chrome/browser/dom_ui/most_visited_handler.h" #include "chrome/browser/history/history_marshaling.h" #include "chrome/browser/history/top_sites_database.h" #include "chrome/browser/history/history_notifications.h" +#include "chrome/common/chrome_paths.h" #include "chrome/test/testing_profile.h" #include "chrome/tools/profiles/thumbnail-inl.h" #include "gfx/codec/jpeg_codec.h" diff --git a/chrome/browser/net/gaia/token_service.cc b/chrome/browser/net/gaia/token_service.cc index eaa7a1ae..103c102 100644 --- a/chrome/browser/net/gaia/token_service.cc +++ b/chrome/browser/net/gaia/token_service.cc @@ -5,9 +5,11 @@ #include "chrome/browser/net/gaia/token_service.h" #include "base/string_util.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/profile.h" #include "chrome/common/net/gaia/gaia_authenticator2.h" #include "chrome/common/net/gaia/gaia_constants.h" +#include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/notification_service.h" // Unfortunately kNumServices must be defined in the .h. diff --git a/chrome/browser/net/gaia/token_service.h b/chrome/browser/net/gaia/token_service.h index 42cb0ea..f687014 100644 --- a/chrome/browser/net/gaia/token_service.h +++ b/chrome/browser/net/gaia/token_service.h @@ -39,12 +39,13 @@ #include <string> #include <vector> #include "base/scoped_ptr.h" +#include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/net/gaia/gaia_auth_consumer.h" #include "chrome/common/net/gaia/gaia_authenticator2.h" -#include "chrome/test/testing_profile.h" #include "base/gtest_prod_util.h" class URLRequestContextGetter; +class Profile; // The TokenService is a Profile member, so all calls are expected // from the UI thread. diff --git a/chrome/browser/net/gaia/token_service_unittest.cc b/chrome/browser/net/gaia/token_service_unittest.cc index a9c6863..1082121 100644 --- a/chrome/browser/net/gaia/token_service_unittest.cc +++ b/chrome/browser/net/gaia/token_service_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/common/net/test_url_fetcher_factory.h" #include "chrome/test/signaling_task.h" #include "chrome/test/test_notification_tracker.h" +#include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" // TestNotificationTracker doesn't do a deep copy on the notification details. diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h index b55ae9d..ab3ad63 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/notifications/desktop_notifications_unittest.h @@ -10,6 +10,7 @@ #include <string> #include "base/message_loop.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/notifications/balloon_collection_impl.h" #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/notifications/notification.h" diff --git a/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc index 6919b0b..5a650ae 100644 --- a/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc +++ b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc @@ -5,6 +5,7 @@ #include "chrome/browser/notifications/notification_exceptions_table_model.h" #include "app/l10n_util.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/test/testing_profile.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc index 7b4ef0b..430e05d 100644 --- a/chrome/browser/password_manager/password_store_default_unittest.cc +++ b/chrome/browser/password_manager/password_store_default_unittest.cc @@ -7,10 +7,12 @@ #include "base/string_util.h" #include "base/scoped_temp_dir.h" #include "base/time.h" +#include "base/utf_string_conversions.h" #include "base/waitable_event.h" #include "chrome/browser/password_manager/password_store_change.h" #include "chrome/browser/password_manager/password_store_default.h" #include "chrome/browser/password_manager/password_form_data.h" +#include "chrome/browser/pref_service.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/password_manager/password_store_win_unittest.cc b/chrome/browser/password_manager/password_store_win_unittest.cc index 6bdea02..8cabe2d 100644 --- a/chrome/browser/password_manager/password_store_win_unittest.cc +++ b/chrome/browser/password_manager/password_store_win_unittest.cc @@ -10,12 +10,14 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/scoped_temp_dir.h" +#include "base/stl_util-inl.h" #include "base/time.h" #include "base/waitable_event.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/password_manager/password_form_data.h" #include "chrome/browser/password_manager/password_store_win.h" #include "chrome/browser/password_manager/ie7_password.h" +#include "chrome/browser/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/signaling_task.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/renderer_host/test/site_instance_unittest.cc b/chrome/browser/renderer_host/test/site_instance_unittest.cc index cf5c154..d965386 100644 --- a/chrome/browser/renderer_host/test/site_instance_unittest.cc +++ b/chrome/browser/renderer_host/test/site_instance_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/stl_util-inl.h" #include "base/string16.h" #include "chrome/browser/browsing_instance.h" #include "chrome/browser/child_process_security_policy.h" diff --git a/chrome/browser/search_engines/template_url_model_unittest.cc b/chrome/browser/search_engines/template_url_model_unittest.cc index f393dcb..baee15a 100644 --- a/chrome/browser/search_engines/template_url_model_unittest.cc +++ b/chrome/browser/search_engines/template_url_model_unittest.cc @@ -3,11 +3,14 @@ // found in the LICENSE file. #include "base/callback.h" +#include "base/file_util.h" #include "base/path_service.h" #include "base/string_util.h" #include "base/thread.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/history/history.h" #include "chrome/browser/history/history_notifications.h" +#include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/webdata/web_database.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc index e037499..e15d598 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc @@ -1,8 +1,11 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + +#include "base/file_util.h" #include "base/scoped_temp_dir.h" #include "base/scoped_vector.h" +#include "chrome/browser/pref_service.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc index 52e832b..b706f7d 100644 --- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/common/json_value_serializer.h" #include "chrome/common/pref_names.h" +#include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -50,7 +51,7 @@ class ProfileSyncServicePreferenceTest virtual void SetUp() { profile_.reset(new TestingProfile()); profile_->set_has_history_service(true); - prefs_ = profile_->GetPrefs(); + prefs_ = profile_->GetTestingPrefService(); prefs_->RegisterStringPref(not_synced_preference_name_.c_str(), not_synced_preference_default_value_); @@ -456,8 +457,8 @@ TEST_F(ProfileSyncServicePreferenceTest, DynamicManagedPreferences) { // Switch kHomePage to managed and set a different value. scoped_ptr<Value> managed_value( Value::CreateStringValue("http://example.com/managed")); - profile_->GetPrefs()->SetManagedPref(prefs::kHomePage, - managed_value->DeepCopy()); + profile_->GetTestingPrefService()->SetManagedPref( + prefs::kHomePage, managed_value->DeepCopy()); // Sync node should be gone. EXPECT_EQ(sync_api::kInvalidId, @@ -480,7 +481,7 @@ TEST_F(ProfileSyncServicePreferenceTest, DynamicManagedPreferences) { EXPECT_TRUE(managed_value->Equals(&GetPreferenceValue(prefs::kHomePage))); // Switch kHomePage back to unmanaged. - profile_->GetPrefs()->RemoveManagedPref(prefs::kHomePage); + profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); // Sync value should be picked up. EXPECT_TRUE(sync_value->Equals(&GetPreferenceValue(prefs::kHomePage))); diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index 9d915c2..0f4a2ec 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -8,6 +8,7 @@ #include "base/scoped_ptr.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/net/gaia/token_service.h" +#include "chrome/browser/pref_service.h" #include "chrome/browser/sync/glue/data_type_manager.h" #include "chrome/browser/sync/glue/data_type_manager_mock.h" #include "chrome/browser/sync/profile_sync_factory_mock.h" diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 11bc2e2..29fcaa4 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -6,6 +6,7 @@ #include <vector> #include "testing/gtest/include/gtest/gtest.h" +#include "base/file_util.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/string_number_conversions.h" @@ -14,6 +15,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/change_processor.h" diff --git a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc index 16c0c7f..5b1141a 100644 --- a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "chrome/browser/browser_url_handler.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 52a4873..8a74269 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" +#include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" #include "ipc/ipc_channel.h" #include "testing/gtest/include/gtest/gtest.h" @@ -193,7 +194,7 @@ class TabContentsTest : public RenderViewHostTestHarness { profile_.reset(profile); // Set some (WebKit) user preferences. - TestingPrefService* pref_services = profile->GetPrefs(); + TestingPrefService* pref_services = profile->GetTestingPrefService(); #if defined(TOOLKIT_USES_GTK) pref_services->SetUserPref(prefs::kUsesSystemTheme, Value::CreateBooleanValue(false)); diff --git a/chrome/browser/translate/translate_manager_unittest.cc b/chrome/browser/translate/translate_manager_unittest.cc index e34307f..302aae01 100644 --- a/chrome/browser/translate/translate_manager_unittest.cc +++ b/chrome/browser/translate/translate_manager_unittest.cc @@ -6,6 +6,7 @@ #include "base/utf_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/pref_service.h" #include "chrome/browser/renderer_host/mock_render_process_host.h" #include "chrome/browser/tab_contents/render_view_context_menu.h" #include "chrome/browser/translate/translate_infobar_delegate.h" diff --git a/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc b/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc index da4eb2c..226591f 100644 --- a/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc +++ b/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc @@ -7,6 +7,7 @@ #include "base/pickle.h" #include "chrome/browser/views/extensions/browser_action_drag_data.h" #include "chrome/test/testing_profile.h" +#include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" namespace { diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index 2b757a6..1162992 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc @@ -7,6 +7,7 @@ #include "base/file_path.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/common/render_messages.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 6292079..2cdf40f 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -5,19 +5,39 @@ #include "chrome/test/testing_profile.h" #include "build/build_config.h" + +#include "base/base_paths.h" #include "base/command_line.h" +#include "base/file_util.h" #include "base/message_loop_proxy.h" +#include "base/path_service.h" #include "base/string_number_conversions.h" -#include "chrome/common/url_constants.h" +#include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/browser_prefs.h" +#include "chrome/browser/browser_theme_provider.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/ntp_resource_cache.h" +#include "chrome/browser/favicon_service.h" +#include "chrome/browser/find_bar_state.h" +#include "chrome/browser/geolocation/geolocation_content_settings_map.h" +#include "chrome/browser/geolocation/geolocation_permission_context.h" +#include "chrome/browser/history/history.h" #include "chrome/browser/history/history_backend.h" +#include "chrome/browser/history/top_sites.h" +#include "chrome/browser/in_process_webkit/webkit_context.h" +#include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/net/gaia/token_service.h" +#include "chrome/browser/notifications/desktop_notification_service.h" +#include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/notification_service.h" +#include "chrome/common/url_constants.h" +#include "chrome/test/testing_pref_service.h" +#include "net/base/cookie_monster.h" #include "net/url_request/url_request_context.h" #include "testing/gmock/include/gmock/gmock.h" #include "webkit/database/database_tracker.h" @@ -300,12 +320,22 @@ void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) { theme_provider_.reset(theme_provider); } +TestingPrefService* TestingProfile::GetTestingPrefService() { + return static_cast<TestingPrefService*>(GetPrefs()); +} + webkit_database::DatabaseTracker* TestingProfile::GetDatabaseTracker() { if (!db_tracker_) db_tracker_ = new webkit_database::DatabaseTracker(GetPath(), false); return db_tracker_; } +net::CookieMonster* TestingProfile::GetCookieMonster() { + if (!GetRequestContext()) + return NULL; + return GetRequestContext()->GetCookieStore()->GetCookieMonster(); +} + void TestingProfile::InitThemes() { if (!created_theme_provider_) { #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) @@ -318,6 +348,26 @@ void TestingProfile::InitThemes() { } } +PrefService* TestingProfile::GetPrefs() { + if (!prefs_.get()) { + prefs_.reset(new TestingPrefService()); + Profile::RegisterUserPrefs(prefs_.get()); + browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); + } + return prefs_.get(); +} + +history::TopSites* TestingProfile::GetTopSites() { + if (!top_sites_.get()) { + top_sites_ = new history::TopSites(this); + if (!temp_dir_.CreateUniqueTempDir()) + return NULL; + FilePath file_name = temp_dir_.path().AppendASCII("TopSites.db"); + top_sites_->Init(file_name); + } + return top_sites_; +} + URLRequestContextGetter* TestingProfile::GetRequestContext() { return request_context_.get(); } @@ -333,16 +383,61 @@ URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { return extensions_request_context_.get(); } +FindBarState* TestingProfile::GetFindBarState() { + if (!find_bar_state_.get()) + find_bar_state_.reset(new FindBarState()); + return find_bar_state_.get(); +} + +HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() { + if (!host_content_settings_map_.get()) + host_content_settings_map_ = new HostContentSettingsMap(this); + return host_content_settings_map_.get(); +} + +GeolocationContentSettingsMap* +TestingProfile::GetGeolocationContentSettingsMap() { + if (!geolocation_content_settings_map_.get()) { + geolocation_content_settings_map_ = + new GeolocationContentSettingsMap(this); + } + return geolocation_content_settings_map_.get(); +} + +GeolocationPermissionContext* +TestingProfile::GetGeolocationPermissionContext() { + if (!geolocation_permission_context_.get()) { + geolocation_permission_context_ = + new GeolocationPermissionContext(this); + } + return geolocation_permission_context_.get(); +} + void TestingProfile::set_session_service(SessionService* session_service) { session_service_ = session_service; } +WebKitContext* TestingProfile::GetWebKitContext() { + if (webkit_context_ == NULL) + webkit_context_ = new WebKitContext(this); + return webkit_context_; +} + NTPResourceCache* TestingProfile::GetNTPResourceCache() { if (!ntp_resource_cache_.get()) ntp_resource_cache_.reset(new NTPResourceCache(this)); return ntp_resource_cache_.get(); } +DesktopNotificationService* TestingProfile::GetDesktopNotificationService() { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + if (!desktop_notification_service_.get()) { + desktop_notification_service_.reset(new DesktopNotificationService( + this, NULL)); + } + return desktop_notification_service_.get(); +} + void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { DCHECK(history_service_.get()); DCHECK(MessageLoop::current()); diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index 1e39f8a..a4814f5 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -6,35 +6,34 @@ #define CHROME_TEST_TESTING_PROFILE_H_ #pragma once -#include "base/base_paths.h" -#include "base/file_util.h" -#include "base/path_service.h" #include "base/scoped_temp_dir.h" -#include "chrome/browser/autocomplete/autocomplete_classifier.h" -#include "chrome/browser/bookmarks/bookmark_model.h" -#include "chrome/browser/browser_prefs.h" -#include "chrome/browser/browser_theme_provider.h" -#include "chrome/browser/chrome_thread.h" -#include "chrome/browser/favicon_service.h" -#include "chrome/browser/find_bar_state.h" -#include "chrome/browser/geolocation/geolocation_content_settings_map.h" -#include "chrome/browser/geolocation/geolocation_permission_context.h" -#include "chrome/browser/host_content_settings_map.h" -#include "chrome/browser/history/history.h" -#include "chrome/browser/history/top_sites.h" -#include "chrome/browser/in_process_webkit/webkit_context.h" -#include "chrome/browser/notifications/desktop_notification_service.h" -#include "chrome/browser/pref_service.h" -#include "chrome/browser/pref_value_store.h" #include "chrome/browser/profile.h" -#include "chrome/browser/search_engines/template_url_model.h" -#include "chrome/common/json_pref_store.h" -#include "chrome/common/net/url_request_context_getter.h" -#include "chrome/test/testing_pref_service.h" -#include "net/base/cookie_monster.h" +namespace history { +class TopSites; +} + +namespace net { +class CookieMonster; +} + +class AutocompleteClassifier; +class BookmarkModel; +class BrowserThemeProvider; +class DesktopNotificationService; +class FaviconService; +class FindBarState; +class GeolocationContentSettingsMap; +class GeolocationPermissionContext; +class HistoryService; +class HostContentSettingsMap; +class PrefService; class ProfileSyncService; class SessionService; +class TemplateURLModel; +class TestingPrefService; +class URLRequestContextGetter; +class WebKitContext; class TestingProfile : public Profile { public: @@ -95,6 +94,8 @@ class TestingProfile : public Profile { // ownership of |theme_provider|. void UseThemeProvider(BrowserThemeProvider* theme_provider); + TestingPrefService* GetTestingPrefService(); + virtual ProfileId GetRuntimeId() { return reinterpret_cast<ProfileId>(this); } @@ -143,11 +144,7 @@ class TestingProfile : public Profile { // The CookieMonster will only be returned if a Context has been created. Do // this by calling CreateRequestContext(). See the note at GetRequestContext // for more information. - net::CookieMonster* GetCookieMonster() { - if (!GetRequestContext()) - return NULL; - return GetRequestContext()->GetCookieStore()->GetCookieMonster(); - } + net::CookieMonster* GetCookieMonster(); virtual AutocompleteClassifier* GetAutocompleteClassifier() { return autocomplete_classifier_.get(); } @@ -160,28 +157,12 @@ class TestingProfile : public Profile { virtual PasswordStore* GetPasswordStore(ServiceAccessType access) { return NULL; } - virtual TestingPrefService* GetPrefs() { - if (!prefs_.get()) { - prefs_.reset(new TestingPrefService()); - Profile::RegisterUserPrefs(prefs_.get()); - browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); - } - return prefs_.get(); - } + virtual PrefService* GetPrefs(); virtual TemplateURLModel* GetTemplateURLModel() { return template_url_model_.get(); } virtual TemplateURLFetcher* GetTemplateURLFetcher() { return NULL; } - virtual history::TopSites* GetTopSites() { - if (!top_sites_.get()) { - top_sites_ = new history::TopSites(this); - if (!temp_dir_.CreateUniqueTempDir()) - return NULL; - FilePath file_name = temp_dir_.path().AppendASCII("TopSites.db"); - top_sites_->Init(file_name); - } - return top_sites_; - } + virtual history::TopSites* GetTopSites(); virtual DownloadManager* GetDownloadManager() { return NULL; } virtual PersonalDataManager* GetPersonalDataManager() { return NULL; } virtual bool HasCreatedDownloadManager() const { return false; } @@ -211,30 +192,10 @@ class TestingProfile : public Profile { virtual net::SSLConfigService* GetSSLConfigService() { return NULL; } virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() { return NULL; } - virtual FindBarState* GetFindBarState() { - if (!find_bar_state_.get()) - find_bar_state_.reset(new FindBarState()); - return find_bar_state_.get(); - } - virtual HostContentSettingsMap* GetHostContentSettingsMap() { - if (!host_content_settings_map_.get()) - host_content_settings_map_ = new HostContentSettingsMap(this); - return host_content_settings_map_.get(); - } - virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap() { - if (!geolocation_content_settings_map_.get()) { - geolocation_content_settings_map_ = - new GeolocationContentSettingsMap(this); - } - return geolocation_content_settings_map_.get(); - } - virtual GeolocationPermissionContext* GetGeolocationPermissionContext() { - if (!geolocation_permission_context_.get()) { - geolocation_permission_context_ = - new GeolocationPermissionContext(this); - } - return geolocation_permission_context_.get(); - } + virtual FindBarState* GetFindBarState(); + virtual HostContentSettingsMap* GetHostContentSettingsMap(); + virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap(); + virtual GeolocationPermissionContext* GetGeolocationPermissionContext(); virtual HostZoomMap* GetHostZoomMap() { return NULL; } void set_session_service(SessionService* session_service); virtual SessionService* GetSessionService() { return session_service_.get(); } @@ -265,24 +226,13 @@ class TestingProfile : public Profile { virtual void ResetTabRestoreService() {} virtual SpellCheckHost* GetSpellCheckHost() { return NULL; } virtual void ReinitializeSpellCheckHost(bool force) { } - virtual WebKitContext* GetWebKitContext() { - if (webkit_context_ == NULL) - webkit_context_ = new WebKitContext(this); - return webkit_context_; - } + virtual WebKitContext* GetWebKitContext(); virtual WebKitContext* GetOffTheRecordWebKitContext() { return NULL; } virtual void MarkAsCleanShutdown() {} virtual void InitExtensions() {} virtual void InitWebResources() {} virtual NTPResourceCache* GetNTPResourceCache(); - virtual DesktopNotificationService* GetDesktopNotificationService() { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); - if (!desktop_notification_service_.get()) { - desktop_notification_service_.reset(new DesktopNotificationService( - this, NULL)); - } - return desktop_notification_service_.get(); - } + virtual DesktopNotificationService* GetDesktopNotificationService(); virtual BackgroundContentsService* GetBackgroundContentsService() { return NULL; } |