summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskyostil <skyostil@chromium.org>2015-04-27 10:59:37 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-27 17:59:35 +0000
commit0becb33779f8678e2703d6ff1a73ce2b45571f98 (patch)
treeca8e900931a5e71c07db40c308a7755b15de1870
parent6974bf71b37bddb36ca8b1feefc013b7c47c105f (diff)
downloadchromium_src-0becb33779f8678e2703d6ff1a73ce2b45571f98.zip
chromium_src-0becb33779f8678e2703d6ff1a73ce2b45571f98.tar.gz
chromium_src-0becb33779f8678e2703d6ff1a73ce2b45571f98.tar.bz2
Ensure tests have an active task runner
This patch modifies all tests to have a more realistic threading set-up by either: a) adding a TestBrowserThreadBundle b) constructing any existing TestBrowserThreadBundle earlier or c) adding a MessageLoop as appropriate. This makes it possible to later migrate base/ from MessageLoopProxy over to ThreadTaskRunnerHandle, which requires an active task runner on the current thread. BUG=465354 Review URL: https://codereview.chromium.org/1086733002 Cr-Commit-Position: refs/heads/master@{#327067}
-rw-r--r--chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc2
-rw-r--r--chrome/browser/autocomplete/autocomplete_provider_unittest.cc4
-rw-r--r--chrome/browser/autocomplete/bookmark_provider_unittest.cc2
-rw-r--r--chrome/browser/autocomplete/shortcuts_backend_unittest.cc8
-rw-r--r--chrome/browser/autocomplete/shortcuts_database_unittest.cc2
-rw-r--r--chrome/browser/background/background_contents_service.cc9
-rw-r--r--chrome/browser/background/background_contents_service.h4
-rw-r--r--chrome/browser/background/background_contents_service_unittest.cc8
-rw-r--r--chrome/browser/background/background_mode_manager_unittest.cc75
-rw-r--r--chrome/browser/browser_about_handler_unittest.cc7
-rw-r--r--chrome/browser/chromeos/dbus/printer_service_provider_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system_util_unittest.cc20
-rw-r--r--chrome/browser/chromeos/login/auth/online_attempt_unittest.cc3
-rw-r--r--chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc5
-rw-r--r--chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc2
-rw-r--r--chrome/browser/chromeos/policy/consumer_management_notifier_factory_unittest.cc2
-rw-r--r--chrome/browser/chromeos/power/power_prefs_unittest.cc2
-rw-r--r--chrome/browser/chromeos/preferences_unittest.cc2
-rw-r--r--chrome/browser/chromeos/profiles/profile_list_chromeos_unittest.cc2
-rw-r--r--chrome/browser/chromeos/system/device_disabling_manager_unittest.cc1
-rw-r--r--chrome/browser/content_settings/content_settings_default_provider_unittest.cc2
-rw-r--r--chrome/browser/content_settings/content_settings_policy_provider_unittest.cc17
-rw-r--r--chrome/browser/content_settings/content_settings_pref_provider_unittest.cc33
-rw-r--r--chrome/browser/download/download_request_limiter_unittest.cc5
-rw-r--r--chrome/browser/download/download_target_determiner_unittest.cc2
-rw-r--r--chrome/browser/drive/drive_api_util_unittest.cc2
-rw-r--r--chrome/browser/extensions/activity_log/uma_policy_unittest.cc2
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc7
-rw-r--r--chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc8
-rw-r--r--chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc2
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc6
-rw-r--r--chrome/browser/extensions/error_console/error_console_unittest.cc2
-rw-r--r--chrome/browser/extensions/extension_action_manager_unittest.cc2
-rw-r--r--chrome/browser/extensions/extension_service_test_base.cc4
-rw-r--r--chrome/browser/extensions/extension_service_test_base.h12
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc8
-rw-r--r--chrome/browser/extensions/extension_special_storage_policy_unittest.cc20
-rw-r--r--chrome/browser/extensions/install_tracker_unittest.cc2
-rw-r--r--chrome/browser/extensions/token_cache/token_cache_service_unittest.cc2
-rw-r--r--chrome/browser/extensions/warning_badge_service_unittest.cc2
-rw-r--r--chrome/browser/font_family_cache_unittest.cc2
-rw-r--r--chrome/browser/lifetime/application_lifetime.cc29
-rw-r--r--chrome/browser/lifetime/application_lifetime.h3
-rw-r--r--chrome/browser/media/webrtc_log_uploader_unittest.cc8
-rw-r--r--chrome/browser/metrics/thread_watcher_unittest.cc1
-rw-r--r--chrome/browser/metrics/variations/variations_service_unittest.cc17
-rw-r--r--chrome/browser/net/dns_probe_service_unittest.cc2
-rw-r--r--chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc1
-rw-r--r--chrome/browser/notifications/extension_welcome_notification_unittest.cc2
-rw-r--r--chrome/browser/password_manager/password_manager_internals_service_unittest.cc9
-rw-r--r--chrome/browser/password_manager/password_manager_metrics_util_unittest.cc2
-rw-r--r--chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc2
-rw-r--r--chrome/browser/prefs/pref_model_associator_unittest.cc2
-rw-r--r--chrome/browser/prefs/proxy_policy_unittest.cc3
-rw-r--r--chrome/browser/prerender/prerender_unittest.cc2
-rw-r--r--chrome/browser/process_singleton_posix_unittest.cc1
-rw-r--r--chrome/browser/search_engines/default_search_pref_migration_unittest.cc2
-rw-r--r--chrome/browser/signin/local_auth_unittest.cc14
-rw-r--r--chrome/browser/spellchecker/feedback_sender_unittest.cc2
-rw-r--r--chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_service_unittest.cc2
-rw-r--r--chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service_unittest.cc2
-rw-r--r--chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update_unittest.cc2
-rw-r--r--chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc2
-rw-r--r--chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc3
-rw-r--r--chrome/browser/sync/glue/sync_backend_registrar_unittest.cc8
-rw-r--r--chrome/browser/sync/profile_sync_service_bookmark_unittest.cc5
-rw-r--r--chrome/browser/sync/profile_sync_service_factory_unittest.cc2
-rw-r--r--chrome/browser/sync/startup_controller_unittest.cc3
-rw-r--r--chrome/browser/thumbnails/thumbnail_service_unittest.cc5
-rw-r--r--chrome/browser/ui/android/tab_model/tab_model_unittest.cc5
-rw-r--r--chrome/browser/ui/autofill/account_chooser_model_unittest.cc2
-rw-r--r--chrome/browser/ui/autofill/country_combobox_model_unittest.cc2
-rw-r--r--chrome/browser/ui/bookmarks/bookmark_ui_utils_unittest.cc9
-rw-r--r--chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm2
-rw-r--r--chrome/browser/ui/omnibox/omnibox_controller_unittest.cc2
-rw-r--r--chrome/browser/ui/omnibox/omnibox_edit_unittest.cc2
-rw-r--r--chrome/browser/ui/passwords/password_bubble_experiment_unittest.cc2
-rw-r--r--chrome/browser/ui/passwords/password_manager_presenter_unittest.cc2
-rw-r--r--chrome/browser/ui/sync/sync_promo_ui_unittest.cc2
-rw-r--r--chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc3
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc2
-rw-r--r--chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc7
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc11
-rw-r--r--chrome/browser/ui/webui/ntp/suggestions_combiner_unittest.cc2
-rw-r--r--chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc5
-rw-r--r--chromeos/dbus/services/service_provider_test_helper.cc8
-rw-r--r--chromeos/dbus/services/service_provider_test_helper.h2
-rw-r--r--components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc1
-rw-r--r--components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc2
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc3
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h1
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc2
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc6
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h3
-rw-r--r--components/search_engines/template_url_service_sync_unittest.cc4
-rw-r--r--content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc2
-rw-r--r--content/public/test/test_renderer_host.h6
-rw-r--r--net/disk_cache/simple/simple_backend_impl.cc4
106 files changed, 369 insertions, 183 deletions
diff --git a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
index 7650042..f361b7a 100644
--- a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
+++ b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/common/extension.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -200,6 +201,7 @@ class ExtensionAppShimHandlerTest : public testing::Test {
std::vector<base::FilePath>());
}
+ content::TestBrowserThreadBundle thread_bundle_;
MockDelegate* delegate_;
scoped_ptr<TestingExtensionAppShimHandler> handler_;
base::FilePath profile_path_a_;
diff --git a/chrome/browser/autocomplete/autocomplete_provider_unittest.cc b/chrome/browser/autocomplete/autocomplete_provider_unittest.cc
index 6db865f..5609909 100644
--- a/chrome/browser/autocomplete/autocomplete_provider_unittest.cc
+++ b/chrome/browser/autocomplete/autocomplete_provider_unittest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -30,6 +29,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
static std::ostream& operator<<(std::ostream& os,
@@ -234,7 +234,7 @@ class AutocompleteProviderTest : public testing::Test,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
- base::MessageLoopForUI message_loop_;
+ content::TestBrowserThreadBundle thread_bundle_;
content::NotificationRegistrar registrar_;
TestingProfile profile_;
scoped_ptr<AutocompleteController> controller_;
diff --git a/chrome/browser/autocomplete/bookmark_provider_unittest.cc b/chrome/browser/autocomplete/bookmark_provider_unittest.cc
index 4afa6be..e9ba234 100644
--- a/chrome/browser/autocomplete/bookmark_provider_unittest.cc
+++ b/chrome/browser/autocomplete/bookmark_provider_unittest.cc
@@ -21,6 +21,7 @@
#include "components/bookmarks/test/test_bookmark_client.h"
#include "components/metrics/proto/omnibox_event.pb.h"
#include "components/omnibox/autocomplete_provider.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
using bookmarks::BookmarkMatch;
@@ -74,6 +75,7 @@ class BookmarkProviderTest : public testing::Test {
protected:
void SetUp() override;
+ content::TestBrowserThreadBundle thread_bundle_;
bookmarks::TestBookmarkClient client_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<BookmarkModel> model_;
diff --git a/chrome/browser/autocomplete/shortcuts_backend_unittest.cc b/chrome/browser/autocomplete/shortcuts_backend_unittest.cc
index 9e8233a..e10692e 100644
--- a/chrome/browser/autocomplete/shortcuts_backend_unittest.cc
+++ b/chrome/browser/autocomplete/shortcuts_backend_unittest.cc
@@ -54,14 +54,16 @@ class ShortcutsBackendTest : public testing::Test,
bool DeleteShortcutsWithIDs(
const ShortcutsDatabase::ShortcutIDs& deleted_ids);
+ private:
+ base::MessageLoopForUI ui_message_loop_;
+ content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread db_thread_;
+
protected:
TestingProfile profile_;
private:
scoped_refptr<ShortcutsBackend> backend_;
- base::MessageLoopForUI ui_message_loop_;
- content::TestBrowserThread ui_thread_;
- content::TestBrowserThread db_thread_;
bool load_notified_;
bool changed_notified_;
diff --git a/chrome/browser/autocomplete/shortcuts_database_unittest.cc b/chrome/browser/autocomplete/shortcuts_database_unittest.cc
index 5c744cd..756752a 100644
--- a/chrome/browser/autocomplete/shortcuts_database_unittest.cc
+++ b/chrome/browser/autocomplete/shortcuts_database_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/testing_profile.h"
#include "components/omnibox/autocomplete_match_type.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "sql/statement.h"
#include "sql/test/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -87,6 +88,7 @@ class ShortcutsDatabaseTest : public testing::Test {
void AddAll();
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
scoped_refptr<ShortcutsDatabase> db_;
};
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index 90a5107..406411b 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -67,6 +67,7 @@ using extensions::UnloadedExtensionInfo;
namespace {
const char kNotificationPrefix[] = "app.background.crashed.";
+bool g_disable_close_balloon_for_testing = false;
void CloseBalloon(const std::string& balloon_id, ProfileID profile_id) {
NotificationUIManager* notification_ui_manager =
@@ -84,7 +85,7 @@ void CloseBalloon(const std::string& balloon_id, ProfileID profile_id) {
// Closes the crash notification balloon for the app/extension with this id.
void ScheduleCloseBalloon(const std::string& extension_id, Profile* profile) {
- if (!base::MessageLoop::current()) // For unit_tests
+ if (g_disable_close_balloon_for_testing)
return;
base::MessageLoop::current()->PostTask(
FROM_HERE,
@@ -293,6 +294,12 @@ void BackgroundContentsService::ShowBalloonForTesting(
ShowBalloon(extension, profile);
}
+// static
+void BackgroundContentsService::DisableCloseBalloonForTesting(
+ bool disable_close_balloon_for_testing) {
+ g_disable_close_balloon_for_testing = disable_close_balloon_for_testing;
+}
+
std::vector<BackgroundContents*>
BackgroundContentsService::GetBackgroundContents() const
{
diff --git a/chrome/browser/background/background_contents_service.h b/chrome/browser/background/background_contents_service.h
index 380982b..1448af6 100644
--- a/chrome/browser/background/background_contents_service.h
+++ b/chrome/browser/background/background_contents_service.h
@@ -75,6 +75,10 @@ class BackgroundContentsService : private content::NotificationObserver,
static void ShowBalloonForTesting(const extensions::Extension* extension,
Profile* profile);
+ // Disable closing the crash notification balloon for tests.
+ static void DisableCloseBalloonForTesting(
+ bool disable_close_balloon_for_testing);
+
// Returns the BackgroundContents associated with the passed application id,
// or NULL if none.
BackgroundContents* GetAppBackgroundContents(const base::string16& appid);
diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc
index 4b23a0d..6d726f0 100644
--- a/chrome/browser/background/background_contents_service_unittest.cc
+++ b/chrome/browser/background/background_contents_service_unittest.cc
@@ -7,7 +7,6 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/run_loop.h"
@@ -25,6 +24,7 @@
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/common/extension.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -44,6 +44,11 @@ class BackgroundContentsServiceTest : public testing::Test {
~BackgroundContentsServiceTest() override {}
void SetUp() override {
command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM));
+ BackgroundContentsService::DisableCloseBalloonForTesting(true);
+ }
+
+ void TearDown() override {
+ BackgroundContentsService::DisableCloseBalloonForTesting(false);
}
const base::DictionaryValue* GetPrefs(Profile* profile) {
@@ -62,6 +67,7 @@ class BackgroundContentsServiceTest : public testing::Test {
return url;
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<base::CommandLine> command_line_;
};
diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc
index 7b58503..8551a7d 100644
--- a/chrome/browser/background/background_mode_manager_unittest.cc
+++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -7,6 +7,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/test_simple_task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "chrome/browser/background/background_mode_manager.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
@@ -44,6 +46,13 @@ using testing::StrictMock;
namespace {
+scoped_ptr<TestingProfileManager> CreateTestingProfileManager() {
+ scoped_ptr<TestingProfileManager> profile_manager(
+ new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
+ EXPECT_TRUE(profile_manager->SetUp());
+ return profile_manager.Pass();
+}
+
// Helper class that tracks state transitions in BackgroundModeManager and
// exposes them via getters (or gmock for EnableLaunchOnStartup).
class TestBackgroundModeManager : public StrictMock<BackgroundModeManager> {
@@ -153,28 +162,19 @@ class BackgroundModeManagerTest : public testing::Test {
command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM));
profile_manager_ = CreateTestingProfileManager();
profile_ = profile_manager_->CreateTestingProfile("p1");
+ chrome::DisableShutdownForTesting(true);
}
- protected:
- scoped_refptr<extensions::Extension> CreateExtension(
- extensions::Manifest::Location location,
- const std::string& data,
- const std::string& id) {
- scoped_ptr<base::DictionaryValue> parsed_manifest(
- extensions::api_test_utils::ParseDictionary(data));
- return extensions::api_test_utils::CreateExtension(
- location, parsed_manifest.get(), id);
- }
-
- // From views::MenuModelAdapter::IsCommandEnabled with modification.
- bool IsCommandEnabled(ui::MenuModel* model, int id) const {
- int index = 0;
- if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index))
- return model->IsEnabledAt(index);
-
- return false;
+ void TearDown() override {
+ // Don't allow the browser to be closed because the shutdown procedure will
+ // attempt to access objects that we haven't created (e.g., MessageCenter).
+ browser_shutdown::SetTryingToQuit(true);
+ chrome::DisableShutdownForTesting(false);
+ browser_shutdown::SetTryingToQuit(false);
}
+ protected:
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<base::CommandLine> command_line_;
scoped_ptr<TestingProfileManager> profile_manager_;
@@ -182,24 +182,18 @@ class BackgroundModeManagerTest : public testing::Test {
TestingProfile* profile_;
private:
- scoped_ptr<TestingProfileManager> CreateTestingProfileManager() {
- scoped_ptr<TestingProfileManager> profile_manager
- (new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
- EXPECT_TRUE(profile_manager->SetUp());
- return profile_manager.Pass();
- }
-
DISALLOW_COPY_AND_ASSIGN(BackgroundModeManagerTest);
};
-class BackgroundModeManagerWithExtensionsTest
- : public BackgroundModeManagerTest {
+class BackgroundModeManagerWithExtensionsTest : public testing::Test {
public:
BackgroundModeManagerWithExtensionsTest() {}
~BackgroundModeManagerWithExtensionsTest() override {}
void SetUp() override {
- BackgroundModeManagerTest::SetUp();
+ command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM));
+ profile_manager_ = CreateTestingProfileManager();
+ profile_ = profile_manager_->CreateTestingProfile("p1");
// Aura clears notifications from the message center at shutdown.
message_center::MessageCenter::Initialize();
@@ -266,6 +260,25 @@ class BackgroundModeManagerWithExtensionsTest
}
protected:
+ scoped_refptr<extensions::Extension> CreateExtension(
+ extensions::Manifest::Location location,
+ const std::string& data,
+ const std::string& id) {
+ scoped_ptr<base::DictionaryValue> parsed_manifest(
+ extensions::api_test_utils::ParseDictionary(data));
+ return extensions::api_test_utils::CreateExtension(
+ location, parsed_manifest.get(), id);
+ }
+
+ // From views::MenuModelAdapter::IsCommandEnabled with modification.
+ bool IsCommandEnabled(ui::MenuModel* model, int id) const {
+ int index = 0;
+ if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index))
+ return model->IsEnabledAt(index);
+
+ return false;
+ }
+
void AddEphemeralApp(const extensions::Extension* extension,
ExtensionService* service) {
extensions::ExtensionPrefs* prefs =
@@ -282,6 +295,12 @@ class BackgroundModeManagerWithExtensionsTest
scoped_ptr<TestBackgroundModeManager> manager_;
+ scoped_ptr<base::CommandLine> command_line_;
+
+ scoped_ptr<TestingProfileManager> profile_manager_;
+ // Test profile used by all tests - this is owned by profile_manager_.
+ TestingProfile* profile_;
+
private:
// Required for extension service.
content::TestBrowserThreadBundle thread_bundle_;
diff --git a/chrome/browser/browser_about_handler_unittest.cc b/chrome/browser/browser_about_handler_unittest.cc
index 2448653..b904287 100644
--- a/chrome/browser/browser_about_handler_unittest.cc
+++ b/chrome/browser/browser_about_handler_unittest.cc
@@ -12,6 +12,7 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/common/referrer.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -20,7 +21,9 @@ using content::NavigationController;
using content::NavigationEntry;
using content::Referrer;
-typedef testing::Test BrowserAboutHandlerTest;
+class BrowserAboutHandlerTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) {
std::string chrome_prefix(content::kChromeUIScheme);
@@ -70,8 +73,6 @@ TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) {
GURL(chrome_prefix + "host/path?query#ref"),
}
};
- base::MessageLoopForUI message_loop;
- content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
TestingProfile profile;
for (size_t i = 0; i < arraysize(test_data); ++i) {
diff --git a/chrome/browser/chromeos/dbus/printer_service_provider_unittest.cc b/chrome/browser/chromeos/dbus/printer_service_provider_unittest.cc
index 7dd3e99..a39b68f 100644
--- a/chrome/browser/chromeos/dbus/printer_service_provider_unittest.cc
+++ b/chrome/browser/chromeos/dbus/printer_service_provider_unittest.cc
@@ -15,6 +15,7 @@
#include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/services/service_provider_test_helper.h"
#include "components/user_manager/fake_user_manager.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "dbus/message.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_builder.h"
@@ -130,6 +131,7 @@ class PrinterServiceProviderAppSearchEnabledTest : public testing::Test {
.Build();
}
+ content::TestBrowserThreadBundle thread_bundle_;
StubNotificationUIManager notification_ui_manager_;
TestingProfile profile_;
user_manager::FakeUserManager* user_manager_;
diff --git a/chrome/browser/chromeos/drive/file_system_util_unittest.cc b/chrome/browser/chromeos/drive/file_system_util_unittest.cc
index 500ac52..7bbbe0a 100644
--- a/chrome/browser/chromeos/drive/file_system_util_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system_util_unittest.cc
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -77,7 +76,11 @@ TEST_F(ProfileRelatedFileSystemUtilTest, ExtractProfileFromPath) {
base::FilePath::FromUTF8Unsafe("/special/non-drive-path")));
}
-TEST(FileSystemUtilTest, IsUnderDriveMountPoint) {
+class FileSystemUtilTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+TEST_F(FileSystemUtilTest, IsUnderDriveMountPoint) {
EXPECT_FALSE(IsUnderDriveMountPoint(
base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
EXPECT_FALSE(IsUnderDriveMountPoint(
@@ -95,7 +98,7 @@ TEST(FileSystemUtilTest, IsUnderDriveMountPoint) {
base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt")));
}
-TEST(FileSystemUtilTest, ExtractDrivePath) {
+TEST_F(FileSystemUtilTest, ExtractDrivePath) {
EXPECT_EQ(base::FilePath(),
ExtractDrivePath(
base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
@@ -117,14 +120,13 @@ TEST(FileSystemUtilTest, ExtractDrivePath) {
base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt")));
}
-TEST(FileSystemUtilTest, ExtractDrivePathFromFileSystemUrl) {
+TEST_F(FileSystemUtilTest, ExtractDrivePathFromFileSystemUrl) {
TestingProfile profile;
// Set up file system context for testing.
base::ScopedTempDir temp_dir_;
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- base::MessageLoop message_loop;
scoped_refptr<storage::ExternalMountPoints> mount_points =
storage::ExternalMountPoints::CreateRefCounted();
scoped_refptr<storage::FileSystemContext> context(
@@ -188,7 +190,7 @@ TEST(FileSystemUtilTest, ExtractDrivePathFromFileSystemUrl) {
isolated_id + "/" + isolated_name))));
}
-TEST(FileSystemUtilTest, EscapeUnescapeCacheFileName) {
+TEST_F(FileSystemUtilTest, EscapeUnescapeCacheFileName) {
const std::string kUnescapedFileName(
"tmp:`~!@#$%^&*()-_=+[{|]}\\\\;\',<.>/?");
const std::string kEscapedFileName(
@@ -197,7 +199,7 @@ TEST(FileSystemUtilTest, EscapeUnescapeCacheFileName) {
EXPECT_EQ(kUnescapedFileName, UnescapeCacheFileName(kEscapedFileName));
}
-TEST(FileSystemUtilTest, NormalizeFileName) {
+TEST_F(FileSystemUtilTest, NormalizeFileName) {
EXPECT_EQ("", NormalizeFileName(""));
EXPECT_EQ("foo", NormalizeFileName("foo"));
// Slash
@@ -213,14 +215,14 @@ TEST(FileSystemUtilTest, NormalizeFileName) {
EXPECT_EQ("._", NormalizeFileName("./"));
}
-TEST(FileSystemUtilTest, GetCacheRootPath) {
+TEST_F(FileSystemUtilTest, GetCacheRootPath) {
TestingProfile profile;
base::FilePath profile_path = profile.GetPath();
EXPECT_EQ(profile_path.AppendASCII("GCache/v1"),
util::GetCacheRootPath(&profile));
}
-TEST(FileSystemUtilTest, GDocFile) {
+TEST_F(FileSystemUtilTest, GDocFile) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
diff --git a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc b/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
index 8ba68a3..6683940 100644
--- a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
+++ b/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
@@ -16,6 +16,7 @@
#include "chromeos/login/auth/online_attempt.h"
#include "chromeos/login/auth/test_attempt_state.h"
#include "chromeos/login/auth/user_context.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
#include "google_apis/gaia/mock_url_fetcher_factory.h"
#include "net/url_request/url_request_context.h"
@@ -84,9 +85,9 @@ class OnlineAttemptTest : public testing::Test {
auth->weak_factory_.GetWeakPtr()));
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_refptr<base::MessageLoopProxy> message_loop_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
- base::MessageLoop loop_;
TestAttemptState state_;
MockAuthAttemptStateResolver resolver_;
scoped_ptr<OnlineAttempt> attempt_;
diff --git a/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc b/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc
index 7969589..beaf843 100644
--- a/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc
+++ b/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -23,6 +24,7 @@
using testing::Mock;
using testing::ReturnRef;
using testing::Sequence;
+using testing::_;
namespace chromeos {
@@ -68,6 +70,9 @@ SAMLOfflineSigninLimiterTest::~SAMLOfflineSigninLimiterTest() {
DestroyLimiter();
Mock::VerifyAndClearExpectations(user_manager_);
EXPECT_CALL(*user_manager_, Shutdown()).Times(1);
+ EXPECT_CALL(*user_manager_, RemoveSessionStateObserver(_)).Times(1);
+ profile_.reset();
+ TestingBrowserProcess::DeleteInstance();
}
void SAMLOfflineSigninLimiterTest::DestroyLimiter() {
diff --git a/chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc b/chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc
index 8e56c19..b1c209d 100644
--- a/chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc
+++ b/chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/chromeos/policy/fake_consumer_management_service.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -52,6 +53,7 @@ class ConsumerEnrollmentHandlerFactoryTest : public testing::Test {
ASSERT_TRUE(testing_profile_manager_->SetUp());
}
+ content::TestBrowserThreadBundle thread_bundle_;
FakeConsumerManagementService* fake_service_;
chromeos::FakeChromeUserManager* fake_user_manager_;
chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_;
diff --git a/chrome/browser/chromeos/policy/consumer_management_notifier_factory_unittest.cc b/chrome/browser/chromeos/policy/consumer_management_notifier_factory_unittest.cc
index ca78a43..5963c82 100644
--- a/chrome/browser/chromeos/policy/consumer_management_notifier_factory_unittest.cc
+++ b/chrome/browser/chromeos/policy/consumer_management_notifier_factory_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/chromeos/policy/fake_consumer_management_service.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -52,6 +53,7 @@ class ConsumerManagementNotifierFactoryTest : public testing::Test {
ASSERT_TRUE(testing_profile_manager_->SetUp());
}
+ content::TestBrowserThreadBundle thread_bundle_;
FakeConsumerManagementService* fake_service_;
chromeos::FakeChromeUserManager* fake_user_manager_;
chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_;
diff --git a/chrome/browser/chromeos/power/power_prefs_unittest.cc b/chrome/browser/chromeos/power/power_prefs_unittest.cc
index 9bf1e9c..dbf34ea 100644
--- a/chrome/browser/chromeos/power/power_prefs_unittest.cc
+++ b/chrome/browser/chromeos/power/power_prefs_unittest.cc
@@ -32,6 +32,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
@@ -60,6 +61,7 @@ class PowerPrefsTest : public testing::Test {
bool GetExpectedAllowScreenWakeLocksForProfile(Profile* profile) const;
bool GetCurrentAllowScreenWakeLocks() const;
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfileManager profile_manager_;
PowerPolicyController* power_policy_controller_; // Not owned.
scoped_ptr<FakePowerManagerClient> fake_power_manager_client_;
diff --git a/chrome/browser/chromeos/preferences_unittest.cc b/chrome/browser/chromeos/preferences_unittest.cc
index b58fb5d..60a4829 100644
--- a/chrome/browser/chromeos/preferences_unittest.cc
+++ b/chrome/browser/chromeos/preferences_unittest.cc
@@ -193,6 +193,7 @@ class PreferencesTest : public testing::Test {
prefs_->SetInputMethodListForTesting();
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfileManager> profile_manager_;
scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
scoped_ptr<Preferences> prefs_;
@@ -352,7 +353,6 @@ class InputMethodPreferencesTest : public PreferencesTest {
StringPrefMember preload_engines_syncable_;
StringPrefMember enabled_extension_imes_;
StringPrefMember enabled_extension_imes_syncable_;
- content::TestBrowserThreadBundle thread_bundle_;
private:
DISALLOW_COPY_AND_ASSIGN(InputMethodPreferencesTest);
diff --git a/chrome/browser/chromeos/profiles/profile_list_chromeos_unittest.cc b/chrome/browser/chromeos/profiles/profile_list_chromeos_unittest.cc
index 2d37fa4..3365bf4 100644
--- a/chrome/browser/chromeos/profiles/profile_list_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/profiles/profile_list_chromeos_unittest.cc
@@ -21,6 +21,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::ASCIIToUTF16;
@@ -106,6 +107,7 @@ class ProfileListChromeOSTest : public testing::Test {
int change_count() const { return mock_observer_->change_count(); }
private:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfileManager manager_;
scoped_ptr<MockObserver> mock_observer_;
scoped_ptr<ScopedUserManagerEnabler> user_manager_enabler_;
diff --git a/chrome/browser/chromeos/system/device_disabling_manager_unittest.cc b/chrome/browser/chromeos/system/device_disabling_manager_unittest.cc
index 771b719..d01d4dd 100644
--- a/chrome/browser/chromeos/system/device_disabling_manager_unittest.cc
+++ b/chrome/browser/chromeos/system/device_disabling_manager_unittest.cc
@@ -136,6 +136,7 @@ class DeviceDisablingManagerOOBETest : public DeviceDisablingManagerTestBase {
TestingPrefServiceSimple local_state_;
+ content::TestBrowserThreadBundle thread_bundle_;
base::RunLoop run_loop_;
bool device_disabled_;
diff --git a/chrome/browser/content_settings/content_settings_default_provider_unittest.cc b/chrome/browser/content_settings/content_settings_default_provider_unittest.cc
index c477a00..7a9b35e 100644
--- a/chrome/browser/content_settings/content_settings_default_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_default_provider_unittest.cc
@@ -13,6 +13,7 @@
#include "components/content_settings/core/browser/content_settings_default_provider.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/test/content_settings_test_utils.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -26,6 +27,7 @@ class DefaultProviderTest : public testing::Test {
~DefaultProviderTest() override { provider_.ShutdownOnUIThread(); }
protected:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
content_settings::DefaultProvider provider_;
};
diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
index 0bf6e4d..ff861bd 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
@@ -20,6 +20,7 @@
#include "components/content_settings/core/browser/content_settings_rule.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/test/content_settings_test_utils.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -29,7 +30,11 @@ namespace content_settings {
typedef std::vector<Rule> Rules;
-TEST(PolicyProviderTest, DefaultGeolocationContentSetting) {
+class PolicyProviderTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+TEST_F(PolicyProviderTest, DefaultGeolocationContentSetting) {
TestingProfile profile;
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
PolicyProvider provider(prefs);
@@ -63,7 +68,7 @@ TEST(PolicyProviderTest, DefaultGeolocationContentSetting) {
provider.ShutdownOnUIThread();
}
-TEST(PolicyProviderTest, ManagedDefaultContentSettings) {
+TEST_F(PolicyProviderTest, ManagedDefaultContentSettings) {
TestingProfile profile;
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
PolicyProvider provider(prefs);
@@ -90,7 +95,7 @@ TEST(PolicyProviderTest, ManagedDefaultContentSettings) {
// When a default-content-setting is set to a managed setting a
// CONTENT_SETTINGS_CHANGED notification should be fired. The same should happen
// if the managed setting is removed.
-TEST(PolicyProviderTest, ObserveManagedSettingsChange) {
+TEST_F(PolicyProviderTest, ObserveManagedSettingsChange) {
TestingProfile profile;
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
PolicyProvider provider(prefs);
@@ -117,7 +122,7 @@ TEST(PolicyProviderTest, ObserveManagedSettingsChange) {
provider.ShutdownOnUIThread();
}
-TEST(PolicyProviderTest, GettingManagedContentSettings) {
+TEST_F(PolicyProviderTest, GettingManagedContentSettings) {
TestingProfile profile;
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
@@ -189,7 +194,7 @@ TEST(PolicyProviderTest, GettingManagedContentSettings) {
provider.ShutdownOnUIThread();
}
-TEST(PolicyProviderTest, ResourceIdentifier) {
+TEST_F(PolicyProviderTest, ResourceIdentifier) {
TestingProfile profile;
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
@@ -226,7 +231,7 @@ TEST(PolicyProviderTest, ResourceIdentifier) {
provider.ShutdownOnUIThread();
}
-TEST(PolicyProviderTest, AutoSelectCertificateList) {
+TEST_F(PolicyProviderTest, AutoSelectCertificateList) {
TestingProfile profile;
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
index e502981..6386a75 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
@@ -31,6 +31,7 @@
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/test/content_settings_test_utils.h"
#include "components/pref_registry/pref_registry_syncable.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -90,7 +91,11 @@ class DeadlockCheckerObserver {
DISALLOW_COPY_AND_ASSIGN(DeadlockCheckerObserver);
};
-TEST(PrefProviderTest, Observer) {
+class PrefProviderTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+TEST_F(PrefProviderTest, Observer) {
TestingProfile profile;
PrefProvider pref_content_settings_provider(profile.GetPrefs(), false);
@@ -117,7 +122,7 @@ TEST(PrefProviderTest, Observer) {
// Test for regression in which the PrefProvider modified the user pref store
// of the OTR unintentionally: http://crbug.com/74466.
-TEST(PrefProviderTest, Incognito) {
+TEST_F(PrefProviderTest, Incognito) {
PersistentPrefStore* user_prefs = new TestingPrefStore();
OverlayUserPrefStore* otr_user_prefs =
new OverlayUserPrefStore(user_prefs);
@@ -184,7 +189,7 @@ TEST(PrefProviderTest, Incognito) {
pref_content_settings_provider_incognito.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, GetContentSettingsValue) {
+TEST_F(PrefProviderTest, GetContentSettingsValue) {
TestingProfile testing_profile;
PrefProvider provider(testing_profile.GetPrefs(), false);
@@ -246,7 +251,7 @@ TEST(PrefProviderTest, GetContentSettingsValue) {
provider.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, Patterns) {
+TEST_F(PrefProviderTest, Patterns) {
TestingProfile testing_profile;
PrefProvider pref_content_settings_provider(testing_profile.GetPrefs(),
false);
@@ -335,7 +340,7 @@ TEST(PrefProviderTest, Patterns) {
pref_content_settings_provider.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, ResourceIdentifier) {
+TEST_F(PrefProviderTest, ResourceIdentifier) {
TestingProfile testing_profile;
PrefProvider pref_content_settings_provider(testing_profile.GetPrefs(),
false);
@@ -371,7 +376,7 @@ TEST(PrefProviderTest, ResourceIdentifier) {
pref_content_settings_provider.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, AutoSubmitCertificateContentSetting) {
+TEST_F(PrefProviderTest, AutoSubmitCertificateContentSetting) {
TestingProfile profile;
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
GURL primary_url("https://www.example.com");
@@ -405,7 +410,7 @@ TEST(PrefProviderTest, AutoSubmitCertificateContentSetting) {
}
// http://crosbug.com/17760
-TEST(PrefProviderTest, Deadlock) {
+TEST_F(PrefProviderTest, Deadlock) {
TestingPrefServiceSyncable prefs;
PrefProvider::RegisterProfilePrefs(prefs.registry());
@@ -428,7 +433,7 @@ TEST(PrefProviderTest, Deadlock) {
provider.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, LastUsage) {
+TEST_F(PrefProviderTest, LastUsage) {
TestingProfile testing_profile;
PrefProvider pref_content_settings_provider(testing_profile.GetPrefs(),
false);
@@ -468,7 +473,7 @@ TEST(PrefProviderTest, LastUsage) {
// aggregate dictionary preferences for all content settings types and the new
// dictionary preferences for individual types. Remove this when the migration
// period is over.
-TEST(PrefProviderTest, SyncingOldToNew) {
+TEST_F(PrefProviderTest, SyncingOldToNew) {
TestingPrefServiceSyncable prefs;
PrefProvider::RegisterProfilePrefs(prefs.registry());
PrefProvider provider(&prefs, false);
@@ -554,7 +559,7 @@ TEST(PrefProviderTest, SyncingOldToNew) {
provider.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, SyncingNewToOld) {
+TEST_F(PrefProviderTest, SyncingNewToOld) {
TestingPrefServiceSyncable prefs;
PrefProvider::RegisterProfilePrefs(prefs.registry());
PrefProvider provider(&prefs, false);
@@ -643,7 +648,7 @@ TEST(PrefProviderTest, SyncingNewToOld) {
}
#if defined(OS_CHROMEOS) || defined(OS_ANDROID)
-TEST(PrefProviderTest, PMIMigrateOnlyAllow) {
+TEST_F(PrefProviderTest, PMIMigrateOnlyAllow) {
TestingPrefServiceSyncable prefs;
PrefProvider::RegisterProfilePrefs(prefs.registry());
@@ -684,7 +689,7 @@ TEST(PrefProviderTest, PMIMigrateOnlyAllow) {
}
#endif
-TEST(PrefProviderTest, PrefsMigrateVerbatim) {
+TEST_F(PrefProviderTest, PrefsMigrateVerbatim) {
TestingPrefServiceSyncable prefs;
PrefProvider::RegisterProfilePrefs(prefs.registry());
@@ -735,7 +740,7 @@ TEST(PrefProviderTest, PrefsMigrateVerbatim) {
provider.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, IncognitoInheritsValueMap) {
+TEST_F(PrefProviderTest, IncognitoInheritsValueMap) {
TestingPrefServiceSyncable prefs;
PrefProvider::RegisterProfilePrefs(prefs.registry());
@@ -802,7 +807,7 @@ TEST(PrefProviderTest, IncognitoInheritsValueMap) {
normal_provider.ShutdownOnUIThread();
}
-TEST(PrefProviderTest, ClearAllContentSettingsRules) {
+TEST_F(PrefProviderTest, ClearAllContentSettingsRules) {
TestingPrefServiceSyncable prefs;
PrefProvider::RegisterProfilePrefs(prefs.registry());
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc
index 4cfc555..46c4243 100644
--- a/chrome/browser/download/download_request_limiter_unittest.cc
+++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -66,6 +66,7 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
void SetUp() override {
ChromeRenderViewHostTestHarness::SetUp();
+ profile_.reset(new TestingProfile());
InfoBarService::CreateForWebContents(web_contents());
PermissionBubbleManager::CreateForWebContents(web_contents());
@@ -80,7 +81,7 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
&DownloadRequestLimiterTest::FakeCreate, base::Unretained(this));
DownloadRequestInfoBarDelegate::SetCallbackForTesting(
&fake_create_callback_);
- content_settings_ = new HostContentSettingsMap(profile_.GetPrefs(), false);
+ content_settings_ = new HostContentSettingsMap(profile_->GetPrefs(), false);
DownloadRequestLimiter::SetContentSettingsForTesting(
content_settings_.get());
}
@@ -198,7 +199,7 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
private:
DownloadRequestInfoBarDelegate::FakeCreateCallback fake_create_callback_;
- TestingProfile profile_;
+ scoped_ptr<TestingProfile> profile_;
scoped_ptr<FakePermissionBubbleView> view_;
};
diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc
index 003906d..ca91bc3 100644
--- a/chrome/browser/download/download_target_determiner_unittest.cc
+++ b/chrome/browser/download/download_target_determiner_unittest.cc
@@ -2015,13 +2015,13 @@ class DownloadTargetDeterminerTestWithPlugin
: old_plugin_service_filter_(NULL) {}
void SetUp() override {
+ DownloadTargetDeterminerTest::SetUp();
content::PluginService* plugin_service =
content::PluginService::GetInstance();
plugin_service->Init();
plugin_service->DisablePluginsDiscoveryForTesting();
old_plugin_service_filter_ = plugin_service->GetFilter();
plugin_service->SetFilter(&mock_plugin_filter_);
- DownloadTargetDeterminerTest::SetUp();
}
void TearDown() override {
diff --git a/chrome/browser/drive/drive_api_util_unittest.cc b/chrome/browser/drive/drive_api_util_unittest.cc
index 179e5b7..60730d4 100644
--- a/chrome/browser/drive/drive_api_util_unittest.cc
+++ b/chrome/browser/drive/drive_api_util_unittest.cc
@@ -52,7 +52,7 @@ TEST(DriveApiUtilTest, TranslateQuery) {
EXPECT_EQ("fullText contains 'dog'", TranslateQuery("\"\" dog \"\""));
}
-TEST(FileSystemUtilTest, CanonicalizeResourceId) {
+TEST(DriveAPIUtilTest, CanonicalizeResourceId) {
std::string resource_id("1YsCnrMxxgp7LDdtlFDt-WdtEIth89vA9inrILtvK-Ug");
// New style ID is unchanged.
diff --git a/chrome/browser/extensions/activity_log/uma_policy_unittest.cc b/chrome/browser/extensions/activity_log/uma_policy_unittest.cc
index 86f57f8..e7ba924 100644
--- a/chrome/browser/extensions/activity_log/uma_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/uma_policy_unittest.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/extensions/activity_log/activity_action_constants.h"
#include "chrome/browser/extensions/activity_log/uma_policy.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/common/dom_action_types.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -18,6 +19,7 @@ class UmaPolicyTest : public testing::Test {
}
protected:
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
};
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
index d581e5f..353f715 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
@@ -91,6 +91,10 @@ class WebRequestActionWithThreadsTest : public testing::Test {
// executable for http://clients1.google.com.
void CheckActionNeedsAllUrls(const char* action, RequestStage stage);
+ private:
+ content::TestBrowserThreadBundle thread_bundle_;
+
+ protected:
net::TestURLRequestContext context_;
// An extension with *.com host permissions and the DWR permission.
@@ -98,9 +102,6 @@ class WebRequestActionWithThreadsTest : public testing::Test {
// An extension with host permissions for all URLs and the DWR permission.
scoped_refptr<Extension> extension_all_urls_;
scoped_refptr<InfoMap> extension_info_map_;
-
- private:
- content::TestBrowserThreadBundle thread_bundle_;
};
void WebRequestActionWithThreadsTest::SetUp() {
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
index 6f6d5e9..1cb5733 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
@@ -7,8 +7,8 @@
#include <vector>
#include "base/guid.h"
-#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_service.h"
+#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h"
#include "chrome/browser/extensions/extension_api_unittest.h"
@@ -17,6 +17,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/profile_sync_service_mock.h"
#include "components/sync_driver/device_info.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/common/extension.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -72,11 +73,10 @@ class MockDeviceInfoTracker : public DeviceInfoTracker {
};
TEST(SignedInDevicesAPITest, GetSignedInDevices) {
+ content::TestBrowserThreadBundle thread_bundle;
TestingProfile profile;
MockDeviceInfoTracker device_tracker;
- base::MessageLoop message_loop_;
- TestExtensionPrefs extension_prefs(
- message_loop_.message_loop_proxy().get());
+ TestExtensionPrefs extension_prefs(base::ThreadTaskRunnerHandle::Get().get());
// Add a couple of devices and make sure we get back public ids for them.
std::string extension_name = "test";
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc
index 708bb4a..322ef96 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc
@@ -12,6 +12,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/signin/core/browser/signin_manager.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/event_router.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -26,6 +27,7 @@ KeyedService* CreateProfileSyncServiceMock(content::BrowserContext* profile) {
// Adds a listener and removes it.
TEST(SignedInDevicesManager, UpdateListener) {
+ content::TestBrowserThreadBundle thread_bundle;
scoped_ptr<TestingProfile> profile(new TestingProfile());
SigninManagerFactory::GetForProfile(profile.get())->
SetAuthenticatedAccountInfo("gaia_id", "foo");
diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
index af510af..e77c585 100644
--- a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
@@ -31,6 +31,9 @@ class ExtensionWebRequestHelpersTestWithThreadsTest : public testing::Test {
protected:
void SetUp() override;
+ private:
+ content::TestBrowserThreadBundle thread_bundle_;
+
protected:
net::TestURLRequestContext context;
@@ -39,9 +42,6 @@ class ExtensionWebRequestHelpersTestWithThreadsTest : public testing::Test {
// This extension has Web Request permissions, and *.com a host permission.
scoped_refptr<Extension> com_extension_;
scoped_refptr<extensions::InfoMap> extension_info_map_;
-
- private:
- content::TestBrowserThreadBundle thread_bundle_;
};
void ExtensionWebRequestHelpersTestWithThreadsTest::SetUp() {
diff --git a/chrome/browser/extensions/error_console/error_console_unittest.cc b/chrome/browser/extensions/error_console/error_console_unittest.cc
index 08cf532..ce686dd 100644
--- a/chrome/browser/extensions/error_console/error_console_unittest.cc
+++ b/chrome/browser/extensions/error_console/error_console_unittest.cc
@@ -13,6 +13,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/crx_file/id_util.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/extension_error.h"
#include "extensions/browser/extension_error_test_util.h"
#include "extensions/browser/extension_registry.h"
@@ -45,6 +46,7 @@ class ErrorConsoleUnitTest : public testing::Test {
}
protected:
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
ErrorConsole* error_console_;
};
diff --git a/chrome/browser/extensions/extension_action_manager_unittest.cc b/chrome/browser/extensions/extension_action_manager_unittest.cc
index 2240125..b29328e 100644
--- a/chrome/browser/extensions/extension_action_manager_unittest.cc
+++ b/chrome/browser/extensions/extension_action_manager_unittest.cc
@@ -7,6 +7,7 @@
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
@@ -55,6 +56,7 @@ class ExtensionActionManagerTest : public testing::Test {
ExtensionActionManager* manager() { return manager_; }
private:
+ content::TestBrowserThreadBundle thread_bundle_;
ExtensionRegistry* registry_;
int curr_id_;
ExtensionActionManager* manager_;
diff --git a/chrome/browser/extensions/extension_service_test_base.cc b/chrome/browser/extensions/extension_service_test_base.cc
index cb0e914..10f16f3 100644
--- a/chrome/browser/extensions/extension_service_test_base.cc
+++ b/chrome/browser/extensions/extension_service_test_base.cc
@@ -73,9 +73,9 @@ ExtensionServiceTestBase::ExtensionServiceInitParams::
}
ExtensionServiceTestBase::ExtensionServiceTestBase()
- : service_(NULL),
+ : thread_bundle_(new content::TestBrowserThreadBundle(kThreadOptions)),
+ service_(NULL),
testing_local_state_(TestingBrowserProcess::GetGlobal()),
- thread_bundle_(new content::TestBrowserThreadBundle(kThreadOptions)),
did_reset_thread_bundle_(false),
registry_(NULL) {
base::FilePath test_data_dir;
diff --git a/chrome/browser/extensions/extension_service_test_base.h b/chrome/browser/extensions/extension_service_test_base.h
index ab48634..85b4d3c 100644
--- a/chrome/browser/extensions/extension_service_test_base.h
+++ b/chrome/browser/extensions/extension_service_test_base.h
@@ -103,6 +103,13 @@ class ExtensionServiceTestBase : public testing::Test {
const base::FilePath& data_dir() const { return data_dir_; }
const base::ScopedTempDir& temp_dir() const { return temp_dir_; }
+ private:
+ // Destroying at_exit_manager_ will delete all LazyInstances, so it must come
+ // after thread_bundle_ in the destruction order.
+ base::ShadowingAtExitManager at_exit_manager_;
+ scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_;
+
+ protected:
// It's unfortunate that these are exposed to subclasses (rather than used
// through the accessor methods above), but too many tests already use them
// directly.
@@ -122,11 +129,6 @@ class ExtensionServiceTestBase : public testing::Test {
// directory.
base::ScopedTempDir temp_dir_;
- // Destroying at_exit_manager_ will delete all LazyInstances, so it must come
- // after thread_bundle_ in the destruction order.
- base::ShadowingAtExitManager at_exit_manager_;
- scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_;
-
// Whether or not the thread bundle was reset in the test.
bool did_reset_thread_bundle_;
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 5911845..4352ffa 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -84,6 +84,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_constants.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
@@ -5598,7 +5599,11 @@ class ExtensionsReadyRecorder : public content::NotificationObserver {
//
// Also tests that we always fire EXTENSIONS_READY, no matter whether we are
// enabled or not.
-TEST(ExtensionServiceTestSimple, Enabledness) {
+class ExtensionServiceTestSimple : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+TEST_F(ExtensionServiceTestSimple, Enabledness) {
// Make sure the PluginService singleton is destroyed at the end of the test.
base::ShadowingAtExitManager at_exit_manager;
#if defined(ENABLE_PLUGINS)
@@ -5609,7 +5614,6 @@ TEST(ExtensionServiceTestSimple, Enabledness) {
ExtensionErrorReporter::Init(false); // no noisy errors
ExtensionsReadyRecorder recorder;
scoped_ptr<TestingProfile> profile(new TestingProfile());
- content::TestBrowserThreadBundle thread_bundle_;
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService device_settings_service;
chromeos::ScopedTestCrosSettings cros_settings;
diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc
index d62eb47..2559832 100644
--- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc
+++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/message_loop/message_loop.h"
#include "base/values.h"
#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
@@ -10,6 +9,7 @@
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
@@ -172,6 +172,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test {
}
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_refptr<ExtensionSpecialStoragePolicy> policy_;
};
@@ -309,9 +310,6 @@ TEST_F(ExtensionSpecialStoragePolicyTest, OverlappingApps) {
}
TEST_F(ExtensionSpecialStoragePolicyTest, HasSessionOnlyOrigins) {
- base::MessageLoop message_loop;
- content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
-
TestingProfile profile;
CookieSettings* cookie_settings =
CookieSettings::Factory::GetForProfile(&profile).get();
@@ -344,10 +342,6 @@ TEST_F(ExtensionSpecialStoragePolicyTest, HasSessionOnlyOrigins) {
}
TEST_F(ExtensionSpecialStoragePolicyTest, NotificationTest) {
- base::MessageLoop message_loop;
- content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
- content::TestBrowserThread io_thread(BrowserThread::IO, &message_loop);
-
PolicyChangeObserver observer;
policy_->AddObserver(&observer);
@@ -368,14 +362,14 @@ TEST_F(ExtensionSpecialStoragePolicyTest, NotificationTest) {
SCOPED_TRACE(testing::Message() << "i: " << i);
observer.ExpectGrant(apps[i]->id(), change_flags[i]);
policy_->GrantRightsForExtension(apps[i].get(), NULL);
- message_loop.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
EXPECT_TRUE(observer.IsCompleted());
}
for (size_t i = 0; i < arraysize(apps); ++i) {
SCOPED_TRACE(testing::Message() << "i: " << i);
policy_->GrantRightsForExtension(apps[i].get(), NULL);
- message_loop.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
EXPECT_TRUE(observer.IsCompleted());
}
@@ -383,20 +377,20 @@ TEST_F(ExtensionSpecialStoragePolicyTest, NotificationTest) {
SCOPED_TRACE(testing::Message() << "i: " << i);
observer.ExpectRevoke(apps[i]->id(), change_flags[i]);
policy_->RevokeRightsForExtension(apps[i].get());
- message_loop.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
EXPECT_TRUE(observer.IsCompleted());
}
for (size_t i = 0; i < arraysize(apps); ++i) {
SCOPED_TRACE(testing::Message() << "i: " << i);
policy_->RevokeRightsForExtension(apps[i].get());
- message_loop.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
EXPECT_TRUE(observer.IsCompleted());
}
observer.ExpectClear();
policy_->RevokeRightsForAllExtensions();
- message_loop.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
EXPECT_TRUE(observer.IsCompleted());
policy_->RemoveObserver(&observer);
diff --git a/chrome/browser/extensions/install_tracker_unittest.cc b/chrome/browser/extensions/install_tracker_unittest.cc
index 4e6cc6f..e02400f 100644
--- a/chrome/browser/extensions/install_tracker_unittest.cc
+++ b/chrome/browser/extensions/install_tracker_unittest.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/extensions/active_install_data.h"
#include "chrome/browser/extensions/install_tracker.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
@@ -64,6 +65,7 @@ class InstallTrackerTest : public testing::Test {
EXPECT_EQ(original.percent_downloaded, retrieved.percent_downloaded);
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<InstallTracker> tracker_;
};
diff --git a/chrome/browser/extensions/token_cache/token_cache_service_unittest.cc b/chrome/browser/extensions/token_cache/token_cache_service_unittest.cc
index 510efd2..f1c6d9b 100644
--- a/chrome/browser/extensions/token_cache/token_cache_service_unittest.cc
+++ b/chrome/browser/extensions/token_cache/token_cache_service_unittest.cc
@@ -7,6 +7,7 @@
#include "base/time/time.h"
#include "chrome/browser/extensions/token_cache/token_cache_service.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::Time;
@@ -44,6 +45,7 @@ class TokenCacheTest : public testing::Test {
}
protected:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
TokenCacheService cache_;
};
diff --git a/chrome/browser/extensions/warning_badge_service_unittest.cc b/chrome/browser/extensions/warning_badge_service_unittest.cc
index 168c494..f01b25be 100644
--- a/chrome/browser/extensions/warning_badge_service_unittest.cc
+++ b/chrome/browser/extensions/warning_badge_service_unittest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/ui/global_error/global_error_service.h"
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/warning_service.h"
#include "extensions/browser/warning_set.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -59,6 +60,7 @@ const char ext2_id[] = "extension2";
// Check that no badge appears if it has been suppressed for a specific
// warning.
TEST(WarningBadgeServiceTest, SuppressBadgeForCurrentWarnings) {
+ content::TestBrowserThreadBundle thread_bundle;
TestingProfile profile;
TestExtensionWarningSet warnings(&profile);
TestWarningBadgeService badge_service(&profile, &warnings);
diff --git a/chrome/browser/font_family_cache_unittest.cc b/chrome/browser/font_family_cache_unittest.cc
index 1911b0b..0470b27 100644
--- a/chrome/browser/font_family_cache_unittest.cc
+++ b/chrome/browser/font_family_cache_unittest.cc
@@ -7,6 +7,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/test/base/testing_pref_service_syncable.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -31,6 +32,7 @@ class TestingFontFamilyCache : public FontFamilyCache {
// Tests that the cache is correctly set and cleared.
TEST(FontFamilyCacheTest, Caching) {
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile;
TestingFontFamilyCache cache(&profile);
TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService();
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index ac9ff01..0d80bd1 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -82,6 +82,7 @@ bool AreAllBrowsersCloseable() {
#endif // !defined(OS_ANDROID)
int g_keep_alive_count = 0;
+bool g_disable_shutdown_for_testing = false;
#if defined(OS_CHROMEOS)
// Whether chrome should send stop request to a session manager.
@@ -319,11 +320,20 @@ void IncrementKeepAliveCount() {
++g_keep_alive_count;
}
+void CloseAllBrowsersIfNeeded() {
+ // If there are no browsers open and we aren't already shutting down,
+ // initiate a shutdown. Also skips shutdown if this is a unit test.
+ // (MessageLoop::current() == null or explicitly disabled).
+ if (chrome::GetTotalBrowserCount() == 0 &&
+ !browser_shutdown::IsTryingToQuit() && base::MessageLoop::current() &&
+ !g_disable_shutdown_for_testing) {
+ CloseAllBrowsers();
+ }
+}
+
void DecrementKeepAliveCount() {
DCHECK_GT(g_keep_alive_count, 0);
--g_keep_alive_count;
-
- DCHECK(g_browser_process);
// Although we should have a browser process, if there is none,
// there is nothing to do.
if (!g_browser_process) return;
@@ -331,14 +341,7 @@ void DecrementKeepAliveCount() {
// Allow the app to shutdown again.
if (!WillKeepAlive()) {
g_browser_process->ReleaseModule();
- // If there are no browsers open and we aren't already shutting down,
- // initiate a shutdown. Also skips shutdown if this is a unit test
- // (MessageLoop::current() == null).
- if (chrome::GetTotalBrowserCount() == 0 &&
- !browser_shutdown::IsTryingToQuit() &&
- base::MessageLoop::current()) {
- CloseAllBrowsers();
- }
+ CloseAllBrowsersIfNeeded();
}
}
@@ -422,4 +425,10 @@ bool ShouldStartShutdown(Browser* browser) {
return true;
}
+void DisableShutdownForTesting(bool disable_shutdown_for_testing) {
+ g_disable_shutdown_for_testing = disable_shutdown_for_testing;
+ if (!g_disable_shutdown_for_testing && !WillKeepAlive())
+ CloseAllBrowsersIfNeeded();
+}
+
} // namespace chrome
diff --git a/chrome/browser/lifetime/application_lifetime.h b/chrome/browser/lifetime/application_lifetime.h
index 9165754..3cf1854 100644
--- a/chrome/browser/lifetime/application_lifetime.h
+++ b/chrome/browser/lifetime/application_lifetime.h
@@ -116,6 +116,9 @@ void HandleAppExitingForPlatform();
// last browser window is being closed.
bool ShouldStartShutdown(Browser* browser);
+// Disable browser shutdown for unit tests.
+void DisableShutdownForTesting(bool disable_shutdown_for_testing);
+
} // namespace chrome
#endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_
diff --git a/chrome/browser/media/webrtc_log_uploader_unittest.cc b/chrome/browser/media/webrtc_log_uploader_unittest.cc
index 2994c8b..c3bf518 100644
--- a/chrome/browser/media/webrtc_log_uploader_unittest.cc
+++ b/chrome/browser/media/webrtc_log_uploader_unittest.cc
@@ -13,6 +13,8 @@
#include "base/strings/string_split.h"
#include "base/time/time.h"
#include "chrome/browser/media/webrtc_log_uploader.h"
+#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
const char kTestTime[] = "time";
@@ -157,6 +159,7 @@ class WebRtcLogUploaderTest : public testing::Test {
EXPECT_EQ(dump_content, lines[i + 3]);
}
+ content::TestBrowserThreadBundle thread_bundle_;
base::FilePath test_list_path_;
};
@@ -247,8 +250,13 @@ TEST_F(WebRtcLogUploaderTest, AddRtpDumpsToPostedData) {
WebRtcLogUploadDoneData upload_done_data;
upload_done_data.log_path = temp_dir.path().AppendASCII("log");
+ scoped_ptr<Profile> profile(new TestingProfile());
+ scoped_refptr<WebRtcLoggingHandlerHost> host(
+ new WebRtcLoggingHandlerHost(profile.get()));
+
upload_done_data.incoming_rtp_dump = incoming_dump;
upload_done_data.outgoing_rtp_dump = outgoing_dump;
+ upload_done_data.host = host.get();
scoped_ptr<WebRtcLogBuffer> log(new WebRtcLogBuffer());
log->SetComplete();
diff --git a/chrome/browser/metrics/thread_watcher_unittest.cc b/chrome/browser/metrics/thread_watcher_unittest.cc
index a53cd49..4b3c457 100644
--- a/chrome/browser/metrics/thread_watcher_unittest.cc
+++ b/chrome/browser/metrics/thread_watcher_unittest.cc
@@ -312,6 +312,7 @@ class ThreadWatcherTest : public ::testing::Test {
}
private:
+ base::MessageLoop message_loop_;
base::Lock lock_;
base::ConditionVariable setup_complete_;
bool initialized_;
diff --git a/chrome/browser/metrics/variations/variations_service_unittest.cc b/chrome/browser/metrics/variations/variations_service_unittest.cc
index 6f67e9c..90f6dbc 100644
--- a/chrome/browser/metrics/variations/variations_service_unittest.cc
+++ b/chrome/browser/metrics/variations/variations_service_unittest.cc
@@ -18,6 +18,7 @@
#include "components/variations/proto/variations_seed.pb.h"
#include "components/web_resource/resource_request_allowed_notifier_test_util.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "net/base/url_util.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
@@ -221,6 +222,7 @@ class VariationsServiceTest : public ::testing::Test {
VariationsServiceTest() {}
private:
+ content::TestBrowserThreadBundle thread_bundle_;
#if defined(OS_CHROMEOS)
// Not used directly. Initializes CrosSettings for testing.
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
@@ -266,9 +268,6 @@ TEST_F(VariationsServiceTest, VariationsURLHasOSNameParam) {
}
TEST_F(VariationsServiceTest, RequestsInitiallyNotAllowed) {
- base::MessageLoopForUI message_loop;
- content::TestBrowserThread ui_thread(content::BrowserThread::UI,
- &message_loop);
TestingPrefServiceSimple prefs;
VariationsService::RegisterPrefs(prefs.registry());
@@ -288,9 +287,6 @@ TEST_F(VariationsServiceTest, RequestsInitiallyNotAllowed) {
}
TEST_F(VariationsServiceTest, RequestsInitiallyAllowed) {
- base::MessageLoopForUI message_loop;
- content::TestBrowserThread ui_thread(content::BrowserThread::UI,
- &message_loop);
TestingPrefServiceSimple prefs;
VariationsService::RegisterPrefs(prefs.registry());
@@ -306,9 +302,6 @@ TEST_F(VariationsServiceTest, RequestsInitiallyAllowed) {
}
TEST_F(VariationsServiceTest, SeedStoredWhenOKStatus) {
- base::MessageLoop message_loop;
- content::TestBrowserThread io_thread(content::BrowserThread::IO,
- &message_loop);
TestingPrefServiceSimple prefs;
VariationsService::RegisterPrefs(prefs.registry());
@@ -339,9 +332,6 @@ TEST_F(VariationsServiceTest, SeedNotStoredWhenNonOKStatus) {
net::HTTP_SERVICE_UNAVAILABLE,
};
- base::MessageLoop message_loop;
- content::TestBrowserThread io_thread(content::BrowserThread::IO,
- &message_loop);
TestingPrefServiceSimple prefs;
VariationsService::RegisterPrefs(prefs.registry());
@@ -363,9 +353,6 @@ TEST_F(VariationsServiceTest, SeedNotStoredWhenNonOKStatus) {
}
TEST_F(VariationsServiceTest, SeedDateUpdatedOn304Status) {
- base::MessageLoop message_loop;
- content::TestBrowserThread io_thread(content::BrowserThread::IO,
- &message_loop);
TestingPrefServiceSimple prefs;
VariationsService::RegisterPrefs(prefs.registry());
diff --git a/chrome/browser/net/dns_probe_service_unittest.cc b/chrome/browser/net/dns_probe_service_unittest.cc
index 5e03b05..1579f47 100644
--- a/chrome/browser/net/dns_probe_service_unittest.cc
+++ b/chrome/browser/net/dns_probe_service_unittest.cc
@@ -74,10 +74,10 @@ class DnsProbeServiceTest : public testing::Test {
callback_result_ = result;
}
+ TestBrowserThreadBundle bundle_;
DnsProbeService service_;
bool callback_called_;
DnsProbeStatus callback_result_;
- TestBrowserThreadBundle bundle_;
};
TEST_F(DnsProbeServiceTest, Probe_OK_OK) {
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc
index 9d0d213..c9de408 100644
--- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc
+++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc
@@ -48,6 +48,7 @@ class DataReductionProxyChromeSettingsTest : public testing::Test {
registry->RegisterDictionaryPref(prefs::kProxy);
}
+ base::MessageLoopForIO message_loop_;
scoped_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_;
scoped_ptr<base::DictionaryValue> dict_;
scoped_ptr<data_reduction_proxy::DataReductionProxyTestContext> test_context_;
diff --git a/chrome/browser/notifications/extension_welcome_notification_unittest.cc b/chrome/browser/notifications/extension_welcome_notification_unittest.cc
index 8881262..43d9d88 100644
--- a/chrome/browser/notifications/extension_welcome_notification_unittest.cc
+++ b/chrome/browser/notifications/extension_welcome_notification_unittest.cc
@@ -14,6 +14,7 @@
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/notifications/notification.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_pref_service_syncable.h"
#include "chrome/test/base/testing_profile.h"
#include "components/pref_registry/pref_registry_syncable.h"
@@ -142,6 +143,7 @@ class ExtensionWelcomeNotificationTest : public testing::Test {
delegate_ = NULL;
welcome_notification_.reset();
profile_.reset();
+ TestingBrowserProcess::DeleteInstance();
thread_task_runner_handle_.reset();
task_runner_ = NULL;
}
diff --git a/chrome/browser/password_manager/password_manager_internals_service_unittest.cc b/chrome/browser/password_manager/password_manager_internals_service_unittest.cc
index 82b7ffe..07badde 100644
--- a/chrome/browser/password_manager/password_manager_internals_service_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_internals_service_unittest.cc
@@ -8,6 +8,7 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
#include "components/password_manager/core/browser/log_receiver.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -46,9 +47,13 @@ scoped_ptr<TestingProfile> CreateProfile(ProfileType type) {
} // namespace
+class PasswordManagerInternalsServiceTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
// When the profile is not incognito, it should be possible to activate the
// service.
-TEST(PasswordManagerInternalsServiceTest, ServiceActiveNonIncognito) {
+TEST_F(PasswordManagerInternalsServiceTest, ServiceActiveNonIncognito) {
scoped_ptr<TestingProfile> profile(CreateProfile(NORMAL_PROFILE));
PasswordManagerInternalsService* service =
PasswordManagerInternalsServiceFactory::GetForBrowserContext(
@@ -68,7 +73,7 @@ TEST(PasswordManagerInternalsServiceTest, ServiceActiveNonIncognito) {
// When the browser profile is incognito, it should not be possible to activate
// the service.
-TEST(PasswordManagerInternalsServiceTest, ServiceNotActiveIncognito) {
+TEST_F(PasswordManagerInternalsServiceTest, ServiceNotActiveIncognito) {
scoped_ptr<TestingProfile> profile(CreateProfile(INCOGNITO_PROFILE));
ASSERT_TRUE(profile);
diff --git a/chrome/browser/password_manager/password_manager_metrics_util_unittest.cc b/chrome/browser/password_manager/password_manager_metrics_util_unittest.cc
index b662dc2..bae03d3 100644
--- a/chrome/browser/password_manager/password_manager_metrics_util_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_metrics_util_unittest.cc
@@ -12,6 +12,7 @@
#include "base/values.h"
#include "chrome/test/base/testing_profile.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
class PasswordManagerMetricsUtilTest : public testing::Test {
@@ -25,6 +26,7 @@ class PasswordManagerMetricsUtilTest : public testing::Test {
return group_id > 0;
}
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
};
diff --git a/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc
index 938d10a..717b749 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc
@@ -52,9 +52,9 @@ class AutocompleteActionPredictorTableTest : public testing::Test {
AutocompleteActionPredictorTable::Rows test_db_;
private:
+ base::MessageLoop loop_;
TestingProfile profile_;
scoped_ptr<PredictorDatabase> db_;
- base::MessageLoop loop_;
content::TestBrowserThread db_thread_;
};
diff --git a/chrome/browser/prefs/pref_model_associator_unittest.cc b/chrome/browser/prefs/pref_model_associator_unittest.cc
index 44e5577..3bdf8dc 100644
--- a/chrome/browser/prefs/pref_model_associator_unittest.cc
+++ b/chrome/browser/prefs/pref_model_associator_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/prefs/pref_model_associator.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
class AbstractPreferenceMergeTest : public testing::Test {
@@ -45,6 +46,7 @@ class AbstractPreferenceMergeTest : public testing::Test {
pref_service_->Set(pref_name.c_str(), *empty_value);
}
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
PrefService* pref_service_;
};
diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc
index b7a5213..80a0874 100644
--- a/chrome/browser/prefs/proxy_policy_unittest.cc
+++ b/chrome/browser/prefs/proxy_policy_unittest.cc
@@ -19,6 +19,7 @@
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_service_impl.h"
#include "components/pref_registry/pref_registry_syncable.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "policy/policy_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -108,7 +109,7 @@ class ProxyPolicyTest : public testing::Test {
return prefs.Pass();
}
- base::MessageLoop loop_;
+ content::TestBrowserThreadBundle thread_bundle_;
base::CommandLine command_line_;
MockConfigurationPolicyProvider provider_;
scoped_ptr<PolicyServiceImpl> policy_service_;
diff --git a/chrome/browser/prerender/prerender_unittest.cc b/chrome/browser/prerender/prerender_unittest.cc
index b0e37e1..1a54e4b 100644
--- a/chrome/browser/prerender/prerender_unittest.cc
+++ b/chrome/browser/prerender/prerender_unittest.cc
@@ -377,8 +377,8 @@ class PrerenderTest : public testing::Test {
private:
// Needed to pass PrerenderManager's DCHECKs.
- TestingProfile profile_;
base::MessageLoop message_loop_;
+ TestingProfile profile_;
content::TestBrowserThread ui_thread_;
scoped_ptr<UnitTestPrerenderManager> prerender_manager_;
scoped_ptr<PrerenderLinkManager> prerender_link_manager_;
diff --git a/chrome/browser/process_singleton_posix_unittest.cc b/chrome/browser/process_singleton_posix_unittest.cc
index f50e760..b62e861 100644
--- a/chrome/browser/process_singleton_posix_unittest.cc
+++ b/chrome/browser/process_singleton_posix_unittest.cc
@@ -252,6 +252,7 @@ class ProcessSingletonPosixTest : public testing::Test {
kill_callbacks_++;
}
+ base::MessageLoop message_loop_;
content::TestBrowserThread io_thread_;
base::ScopedTempDir temp_dir_;
base::WaitableEvent wait_event_;
diff --git a/chrome/browser/search_engines/default_search_pref_migration_unittest.cc b/chrome/browser/search_engines/default_search_pref_migration_unittest.cc
index 5508736..c4f0261 100644
--- a/chrome/browser/search_engines/default_search_pref_migration_unittest.cc
+++ b/chrome/browser/search_engines/default_search_pref_migration_unittest.cc
@@ -21,6 +21,7 @@
#include "components/search_engines/search_engines_pref_names.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -44,6 +45,7 @@ class DefaultSearchPrefMigrationTest : public testing::Test {
}
private:
+ content::TestBrowserThreadBundle thread_bundle_;
base::ScopedTempDir temp_dir_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<DefaultSearchManager> default_search_manager_;
diff --git a/chrome/browser/signin/local_auth_unittest.cc b/chrome/browser/signin/local_auth_unittest.cc
index 14aea88..a675290 100644
--- a/chrome/browser/signin/local_auth_unittest.cc
+++ b/chrome/browser/signin/local_auth_unittest.cc
@@ -12,10 +12,15 @@
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/os_crypt/os_crypt.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
-TEST(LocalAuthTest, SetAndCheckCredentials) {
+class LocalAuthTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+TEST_F(LocalAuthTest, SetAndCheckCredentials) {
TestingProfileManager testing_profile_manager(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(testing_profile_manager.SetUp());
@@ -55,8 +60,7 @@ TEST(LocalAuthTest, SetAndCheckCredentials) {
EXPECT_NE(passhash, cache.GetLocalAuthCredentialsOfProfileAtIndex(0));
}
-
-TEST(LocalAuthTest, SetUpgradeAndCheckCredentials) {
+TEST_F(LocalAuthTest, SetUpgradeAndCheckCredentials) {
TestingProfileManager testing_profile_manager(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(testing_profile_manager.SetUp());
@@ -92,7 +96,7 @@ TEST(LocalAuthTest, SetUpgradeAndCheckCredentials) {
}
// Test truncation where each byte is left whole.
-TEST(LocalAuthTest, TruncateStringEvenly) {
+TEST_F(LocalAuthTest, TruncateStringEvenly) {
std::string two_chars = "A6";
std::string three_chars = "A6C";
EXPECT_EQ(two_chars, LocalAuth::TruncateStringByBits(two_chars, 16));
@@ -103,7 +107,7 @@ TEST(LocalAuthTest, TruncateStringEvenly) {
}
// Test truncation that affects the results within a byte.
-TEST(LocalAuthTest, TruncateStringUnevenly) {
+TEST_F(LocalAuthTest, TruncateStringUnevenly) {
std::string two_chars = "Az";
std::string three_chars = "AzC";
// 'z' = 0x7A, ':' = 0x3A.
diff --git a/chrome/browser/spellchecker/feedback_sender_unittest.cc b/chrome/browser/spellchecker/feedback_sender_unittest.cc
index 5f6963d..93949fb 100644
--- a/chrome/browser/spellchecker/feedback_sender_unittest.cc
+++ b/chrome/browser/spellchecker/feedback_sender_unittest.cc
@@ -141,8 +141,8 @@ class FeedbackSenderTest : public testing::Test {
scoped_ptr<spellcheck::FeedbackSender> feedback_;
private:
- TestingProfile profile_;
base::MessageLoop loop_;
+ TestingProfile profile_;
content::TestBrowserThread ui_thread_;
scoped_ptr<base::FieldTrialList> field_trial_list_;
scoped_refptr<base::FieldTrial> field_trial_;
diff --git a/chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_service_unittest.cc b/chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_service_unittest.cc
index 4d18590..67224b5 100644
--- a/chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_service_unittest.cc
+++ b/chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_service_unittest.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/supervised_user/supervised_user_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
const char kFakeSupervisedUserId[] = "fakeID";
@@ -38,6 +39,7 @@ class SupervisedUserPrefMappingServiceTest : public ::testing::Test {
shared_settings_service_->Shutdown();
}
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
SupervisedUserSharedSettingsService* shared_settings_service_;
SupervisedUserPrefMappingService* mapping_service_;
diff --git a/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service_unittest.cc b/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service_unittest.cc
index 522fe7c..eed022a 100644
--- a/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service_unittest.cc
+++ b/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service_unittest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "sync/api/fake_sync_change_processor.h"
#include "sync/api/sync_change.h"
#include "sync/api/sync_change_processor_wrapper_for_test.h"
@@ -130,6 +131,7 @@ class SupervisedUserSharedSettingsServiceTest : public ::testing::Test {
su_id, key, *value, true));
}
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
SupervisedUserSharedSettingsService settings_service_;
SyncDataList changed_settings_;
diff --git a/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update_unittest.cc b/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update_unittest.cc
index 17f9f14..59329ac 100644
--- a/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update_unittest.cc
+++ b/chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update_unittest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service.h"
#include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "sync/api/sync_change.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,6 +21,7 @@ class SupervisedUserSharedSettingsUpdateTest : public testing::Test {
}
protected:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
SupervisedUserSharedSettingsService service_;
scoped_ptr<bool> result_;
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
index 60e37a8..40a738a 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
+++ b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
@@ -8,6 +8,7 @@
#include "base/prefs/testing_pref_store.h"
#include "base/strings/string_util.h"
#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "sync/api/fake_sync_change_processor.h"
#include "sync/api/sync_change.h"
#include "sync/api/sync_change_processor_wrapper_for_test.h"
@@ -133,6 +134,7 @@ class SupervisedUserSettingsServiceTest : public ::testing::Test {
void TearDown() override { settings_service_.Shutdown(); }
+ content::TestBrowserThreadBundle thread_bundle_;
base::DictionaryValue split_items_;
scoped_ptr<base::Value> atomic_setting_value_;
SupervisedUserSettingsService settings_service_;
diff --git a/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc
index 2ea29670..a269d8d 100644
--- a/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc
+++ b/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc
@@ -21,6 +21,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "sync/api/sync_change.h"
#include "sync/api/sync_error_factory.h"
#include "sync/protocol/sync.pb.h"
@@ -152,7 +153,7 @@ class SupervisedUserWhitelistServiceTest : public testing::Test {
site_lists_changed_callback_.Run();
}
- base::MessageLoop message_loop_;
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
scoped_ptr<MockSupervisedUserWhitelistInstaller> installer_;
diff --git a/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc b/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc
index 1129bbf..3db65e9 100644
--- a/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc
+++ b/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc
@@ -60,10 +60,10 @@ class SyncBackendRegistrarTest : public testing::Test {
protected:
SyncBackendRegistrarTest()
- : sync_thread_(NULL),
- thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD |
+ : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD |
content::TestBrowserThreadBundle::REAL_FILE_THREAD |
- content::TestBrowserThreadBundle::REAL_IO_THREAD) {}
+ content::TestBrowserThreadBundle::REAL_IO_THREAD),
+ sync_thread_(NULL) {}
~SyncBackendRegistrarTest() override {}
@@ -101,12 +101,12 @@ class SyncBackendRegistrarTest : public testing::Test {
}
}
+ content::TestBrowserThreadBundle thread_bundle_;
syncer::TestUserShare test_user_share_;
TestingProfile profile_;
scoped_ptr<SyncBackendRegistrar> registrar_;
base::Thread* sync_thread_;
- content::TestBrowserThreadBundle thread_bundle_;
};
TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) {
diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
index 17ed42e..5974e36 100644
--- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
@@ -328,7 +328,6 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
ProfileSyncServiceBookmarkTest()
: model_(NULL),
- thread_bundle_(content::TestBrowserThreadBundle::DEFAULT),
local_merge_result_(syncer::BOOKMARKS),
syncer_merge_result_(syncer::BOOKMARKS) {}
@@ -753,6 +752,9 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
model_->bookmark_bar_node()->id());
}
+ private:
+ content::TestBrowserThreadBundle thread_bundle_;
+
protected:
TestingProfile profile_;
BookmarkModel* model_;
@@ -762,7 +764,6 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
scoped_ptr<BookmarkModelAssociator> model_associator_;
private:
- content::TestBrowserThreadBundle thread_bundle_;
syncer::SyncMergeResult local_merge_result_;
syncer::SyncMergeResult syncer_merge_result_;
};
diff --git a/chrome/browser/sync/profile_sync_service_factory_unittest.cc b/chrome/browser/sync/profile_sync_service_factory_unittest.cc
index e3c2da1..c1fb61b 100644
--- a/chrome/browser/sync/profile_sync_service_factory_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_factory_unittest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
class ProfileSyncServiceFactoryTest : public testing::Test {
@@ -17,6 +18,7 @@ class ProfileSyncServiceFactoryTest : public testing::Test {
profile_.reset(new TestingProfile());
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<Profile> profile_;
};
diff --git a/chrome/browser/sync/startup_controller_unittest.cc b/chrome/browser/sync/startup_controller_unittest.cc
index 186a759..9c1d537 100644
--- a/chrome/browser/sync/startup_controller_unittest.cc
+++ b/chrome/browser/sync/startup_controller_unittest.cc
@@ -16,6 +16,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
#include "components/sync_driver/sync_prefs.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace browser_sync {
@@ -94,7 +95,7 @@ class StartupControllerTest : public testing::Test {
private:
bool started_;
- base::MessageLoop message_loop_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<StartupController> controller_;
scoped_ptr<FakeSupervisedUserSigninManagerWrapper> signin_;
scoped_ptr<FakeProfileOAuth2TokenService> token_service_;
diff --git a/chrome/browser/thumbnails/thumbnail_service_unittest.cc b/chrome/browser/thumbnails/thumbnail_service_unittest.cc
index bdc2cf0..075983a 100644
--- a/chrome/browser/thumbnails/thumbnail_service_unittest.cc
+++ b/chrome/browser/thumbnails/thumbnail_service_unittest.cc
@@ -11,9 +11,12 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/history/core/browser/top_sites_impl.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
-typedef testing::Test ThumbnailServiceTest;
+class ThumbnailServiceTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
namespace {
diff --git a/chrome/browser/ui/android/tab_model/tab_model_unittest.cc b/chrome/browser/ui/android/tab_model/tab_model_unittest.cc
index 8f099e0..103c08c 100644
--- a/chrome/browser/ui/android/tab_model/tab_model_unittest.cc
+++ b/chrome/browser/ui/android/tab_model/tab_model_unittest.cc
@@ -8,10 +8,13 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-typedef testing::Test TabModelTest;
+class TabModelTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
namespace {
class TabModelAndroidProfileMock : public TestingProfile {
diff --git a/chrome/browser/ui/autofill/account_chooser_model_unittest.cc b/chrome/browser/ui/autofill/account_chooser_model_unittest.cc
index 39fe699..e2f9b5c 100644
--- a/chrome/browser/ui/autofill/account_chooser_model_unittest.cc
+++ b/chrome/browser/ui/autofill/account_chooser_model_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/autofill/core/browser/autofill_metrics.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -53,6 +54,7 @@ class AccountChooserModelTest : public testing::Test {
TestAccountChooserModel* model() { return &model_; }
private:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
testing::NiceMock<MockAccountChooserModelDelegate> delegate_;
TestAccountChooserModel model_;
diff --git a/chrome/browser/ui/autofill/country_combobox_model_unittest.cc b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
index 1952c14..8c0d88e 100644
--- a/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
+++ b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
@@ -11,6 +11,7 @@
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/test_personal_data_manager.h"
#include "components/signin/core/browser/account_tracker_service.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui_component.h"
@@ -34,6 +35,7 @@ class CountryComboboxModelTest : public testing::Test {
private:
// NB: order is important here - |profile_| must go down after |manager_|.
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
TestPersonalDataManager manager_;
scoped_ptr<CountryComboboxModel> model_;
diff --git a/chrome/browser/ui/bookmarks/bookmark_ui_utils_unittest.cc b/chrome/browser/ui/bookmarks/bookmark_ui_utils_unittest.cc
index 770be53..c252dbe 100644
--- a/chrome/browser/ui/bookmarks/bookmark_ui_utils_unittest.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_ui_utils_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/test/base/testing_profile.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/test/test_bookmark_client.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#if !defined(OS_ANDROID) && !defined(OS_IOS)
@@ -18,7 +19,11 @@ using bookmarks::BookmarkNode;
namespace {
-TEST(BookmarkUIUtilsTest, HasBookmarkURLs) {
+class BookmarkUIUtilsTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+TEST_F(BookmarkUIUtilsTest, HasBookmarkURLs) {
bookmarks::TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
@@ -60,7 +65,7 @@ TEST(BookmarkUIUtilsTest, HasBookmarkURLs) {
EXPECT_FALSE(chrome::HasBookmarkURLs(nodes));
}
-TEST(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) {
+TEST_F(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) {
bookmarks::TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
TestingProfile profile;
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm
index d357b89..475e5e8 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm
@@ -17,6 +17,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest_mac.h"
#import "ui/base/cocoa/controls/hyperlink_button_cell.h"
#include "ui/events/test/cocoa_test_event_utils.h"
@@ -67,6 +68,7 @@ class AvatarMenuBubbleControllerTest : public CocoaTest {
}
private:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfileManager manager_;
// Weak; releases self.
diff --git a/chrome/browser/ui/omnibox/omnibox_controller_unittest.cc b/chrome/browser/ui/omnibox/omnibox_controller_unittest.cc
index 423bc87..b6075b94 100644
--- a/chrome/browser/ui/omnibox/omnibox_controller_unittest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_controller_unittest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/ui/omnibox/omnibox_controller.h"
#include "chrome/test/base/testing_profile.h"
#include "components/omnibox/autocomplete_provider.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
class OmniboxControllerTest : public testing::Test {
@@ -23,6 +24,7 @@ class OmniboxControllerTest : public testing::Test {
}
private:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
scoped_ptr<OmniboxController> omnibox_controller_;
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc b/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc
index 934e39f..87c9738 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/toolbar/test_toolbar_model.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::ASCIIToUTF16;
@@ -128,6 +129,7 @@ class AutocompleteEditTest : public ::testing::Test {
TestToolbarModel* toolbar_model() { return &toolbar_model_; }
private:
+ content::TestBrowserThreadBundle thread_bundle_;
TestToolbarModel toolbar_model_;
};
diff --git a/chrome/browser/ui/passwords/password_bubble_experiment_unittest.cc b/chrome/browser/ui/passwords/password_bubble_experiment_unittest.cc
index e6084b9..6533742 100644
--- a/chrome/browser/ui/passwords/password_bubble_experiment_unittest.cc
+++ b/chrome/browser/ui/passwords/password_bubble_experiment_unittest.cc
@@ -12,6 +12,7 @@
#include "chrome/test/base/testing_profile.h"
#include "components/variations/entropy_provider.h"
#include "components/variations/variations_associated_data.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -51,6 +52,7 @@ class PasswordBubbleExperimentTest : public testing::Test {
PrefService* prefs() { return profile_->GetPrefs(); }
private:
+ content::TestBrowserThreadBundle thread_bundle_;
base::ScopedTempDir temp_dir_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<base::FieldTrialList> field_trial_list_;
diff --git a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
index 2c03ab8..9669bb0 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/ui/passwords/password_ui_view.h"
#include "chrome/test/base/testing_profile.h"
#include "components/password_manager/core/browser/mock_password_store.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -66,6 +67,7 @@ class PasswordManagerPresenterTest : public testing::Test {
MockPasswordUIView* GetUIController() { return mock_controller_.get(); }
private:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
scoped_ptr<MockPasswordUIView> mock_controller_;
diff --git a/chrome/browser/ui/sync/sync_promo_ui_unittest.cc b/chrome/browser/ui/sync/sync_promo_ui_unittest.cc
index e19b22c..a44dffc 100644
--- a/chrome/browser/ui/sync/sync_promo_ui_unittest.cc
+++ b/chrome/browser/ui/sync/sync_promo_ui_unittest.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
class SyncPromoUITest : public testing::Test {
@@ -33,6 +34,7 @@ class SyncPromoUITest : public testing::Test {
switches::kDisableSync);
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
private:
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc
index b256553b..cbf5b820 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc
@@ -51,10 +51,9 @@ class AppInfoPermissionsPanelTest : public testing::Test {
.Build();
}
- TestingProfile profile_;
-
// We need the UI thread in order to construct UI elements in the view.
content::TestBrowserThreadBundle thread_bundle_;
+ TestingProfile profile_;
};
// Tests that an app with no permissions is treated correctly.
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
index a748590..c12e047 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/command_updater.h"
#include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_CHROMEOS)
@@ -106,6 +107,7 @@ class OmniboxViewViewsTest : public testing::Test {
#endif
}
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
CommandUpdater command_updater_;
TestingOmniboxEditController omnibox_edit_controller_;
diff --git a/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc b/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
index f399491..70a00e4 100644
--- a/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
+++ b/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
@@ -8,7 +8,6 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "chrome/browser/chromeos/login/users/mock_user_manager.h"
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
@@ -17,6 +16,7 @@
#include "chromeos/dbus/fake_update_engine_client.h"
#include "chromeos/dbus/shill_service_client.h"
#include "chromeos/network/network_handler.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -67,7 +67,7 @@ class VersionUpdaterCrosTest : public ::testing::Test {
"eth",
shill::kTypeEthernet, shill::kStateOnline,
true /* visible */);
- loop_.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
void TearDown() override {
@@ -77,14 +77,13 @@ class VersionUpdaterCrosTest : public ::testing::Test {
DeviceSettingsService::Shutdown();
}
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<VersionUpdater> version_updater_;
FakeUpdateEngineClient* fake_update_engine_client_; // Not owned.
MockUserManager* mock_user_manager_; // Not owned.
ScopedUserManagerEnabler user_manager_enabler_;
- base::MessageLoop loop_;
-
DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCrosTest);
};
diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc b/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc
index 59632f0..e6493f1 100644
--- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc
@@ -9,6 +9,7 @@
#include "base/metrics/statistics_recorder.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/ntp_logging_events.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -36,7 +37,11 @@ base::HistogramBase::Count GetBinCount(const std::string& histogram_name,
} // namespace
-TEST(NTPUserDataLoggerTest, TestLogging) {
+class NTPUserDataLoggerTest : public testing::Test {
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+TEST_F(NTPUserDataLoggerTest, TestLogging) {
base::StatisticsRecorder::Initialize();
// Ensure empty statistics.
@@ -101,7 +106,7 @@ TEST(NTPUserDataLoggerTest, TestLogging) {
EXPECT_EQ(1, GetTotalCount("NewTabPage.SuggestionsType"));
}
-TEST(NTPUserDataLoggerTest, TestLogMostVisitedImpression) {
+TEST_F(NTPUserDataLoggerTest, TestLogMostVisitedImpression) {
base::StatisticsRecorder::Initialize();
EXPECT_EQ(0, GetBinCount("NewTabPage.SuggestionsImpression.foobar", 1));
@@ -127,7 +132,7 @@ TEST(NTPUserDataLoggerTest, TestLogMostVisitedImpression) {
EXPECT_EQ(1, GetBinCount("NewTabPage.SuggestionsImpression.foobar", 5));
}
-TEST(NTPUserDataLoggerTest, TestLogMostVisitedNavigation) {
+TEST_F(NTPUserDataLoggerTest, TestLogMostVisitedNavigation) {
base::StatisticsRecorder::Initialize();
EXPECT_EQ(0, GetTotalCount("NewTabPage.MostVisited"));
diff --git a/chrome/browser/ui/webui/ntp/suggestions_combiner_unittest.cc b/chrome/browser/ui/webui/ntp/suggestions_combiner_unittest.cc
index 6e5daad..d6bc880 100644
--- a/chrome/browser/ui/webui/ntp/suggestions_combiner_unittest.cc
+++ b/chrome/browser/ui/webui/ntp/suggestions_combiner_unittest.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h"
#include "chrome/browser/ui/webui/ntp/suggestions_source.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -204,6 +205,7 @@ class SuggestionsCombinerTest : public testing::Test {
}
protected:
+ content::TestBrowserThreadBundle thread_bundle_;
Profile* profile_;
SuggestionsHandler* suggestions_handler_;
SuggestionsCombiner* combiner_;
diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
index 35517fa..1f701a6 100644
--- a/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/local_discovery/pwg_raster_converter.h"
#include "chrome/browser/ui/webui/print_preview/extension_printer_handler.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/api/printer_provider/printer_provider_api.h"
#include "extensions/browser/api/printer_provider/printer_provider_api_factory.h"
#include "extensions/browser/api/printer_provider/printer_provider_print_job.h"
@@ -370,7 +371,7 @@ class ExtensionPrinterHandlerTest : public testing::Test {
profile_ = profile_builder.Build();
extension_printer_handler_.reset(new ExtensionPrinterHandler(
- profile_.get(), message_loop_.task_runner()));
+ profile_.get(), base::MessageLoop::current()->task_runner()));
pwg_raster_converter_ = new FakePWGRasterConverter();
extension_printer_handler_->SetPwgRasterConverterForTesting(
@@ -389,7 +390,7 @@ class ExtensionPrinterHandlerTest : public testing::Test {
FakePWGRasterConverter* pwg_raster_converter_;
private:
- base::MessageLoop message_loop_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
diff --git a/chromeos/dbus/services/service_provider_test_helper.cc b/chromeos/dbus/services/service_provider_test_helper.cc
index c4c5c65..9b70172 100644
--- a/chromeos/dbus/services/service_provider_test_helper.cc
+++ b/chromeos/dbus/services/service_provider_test_helper.cc
@@ -20,6 +20,8 @@ namespace chromeos {
ServiceProviderTestHelper::ServiceProviderTestHelper()
: response_received_(false) {
+ if (!base::MessageLoop::current())
+ message_loop_.reset(new base::MessageLoop());
}
ServiceProviderTestHelper::~ServiceProviderTestHelper() {
@@ -129,7 +131,7 @@ dbus::Response* ServiceProviderTestHelper::MockCallMethodAndBlock(
base::Unretained(this)));
// Check for a response.
if (!response_received_)
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
// Return response.
return response_.release();
}
@@ -155,8 +157,8 @@ void ServiceProviderTestHelper::OnResponse(
scoped_ptr<dbus::Response> response) {
response_ = response.Pass();
response_received_ = true;
- if (message_loop_.is_running())
- message_loop_.Quit();
+ if (base::MessageLoop::current()->is_running())
+ base::MessageLoop::current()->Quit();
}
} // namespace chromeos
diff --git a/chromeos/dbus/services/service_provider_test_helper.h b/chromeos/dbus/services/service_provider_test_helper.h
index 196f6a6..c5091b1 100644
--- a/chromeos/dbus/services/service_provider_test_helper.h
+++ b/chromeos/dbus/services/service_provider_test_helper.h
@@ -88,7 +88,7 @@ class ServiceProviderTestHelper {
scoped_refptr<dbus::MockObjectProxy> mock_object_proxy_;
dbus::ExportedObject::MethodCallCallback method_callback_;
dbus::ObjectProxy::SignalCallback on_signal_callback_;
- base::MessageLoop message_loop_;
+ scoped_ptr<base::MessageLoop> message_loop_;
bool response_received_;
scoped_ptr<dbus::Response> response_;
};
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc
index e7e3789..7845c05 100644
--- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc
+++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc
@@ -105,6 +105,7 @@ class DataReductionProxyDebugResourceThrottleTest : public testing::Test {
}
private:
+ base::MessageLoop message_loop_;
net::TestURLRequestContext context_;
net::TestDelegate delegate_;
// |test_job_interceptor_| is owned by |test_job_factory_|.
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc
index ab2252b..eef60db 100644
--- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc
+++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc
@@ -38,6 +38,7 @@ class DataReductionProxyMessageFilterTest : public testing::Test {
}
private:
+ base::MessageLoopForIO message_loop_;
scoped_ptr<DataReductionProxyTestContext> test_context_;
scoped_refptr<DataReductionProxyMessageFilter> message_filter_;
};
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
index 0934c3e..d6f2da6 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
@@ -311,6 +311,7 @@ class DataReductionProxyProtocolTest : public testing::Test {
}
protected:
+ base::MessageLoopForIO message_loop_;
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
scoped_ptr<net::URLRequestInterceptor> simple_interceptor_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
index cc1930e..bf1345e 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
@@ -130,6 +130,7 @@ class DataReductionProxyBypassStatsTest : public testing::Test {
}
private:
+ base::MessageLoopForIO message_loop_;
net::TestURLRequestContext context_;
net::TestDelegate delegate_;
scoped_ptr<net::URLRequest> mock_url_request_;
@@ -704,6 +705,7 @@ class DataReductionProxyBypassStatsEndToEndTest : public testing::Test {
}
private:
+ base::MessageLoopForIO message_loop_;
net::TestDelegate delegate_;
net::MockClientSocketFactory mock_socket_factory_;
net::TestURLRequestContext context_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc
index 19ec5f4..ca35828 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc
@@ -146,6 +146,7 @@ class DataReductionProxyConfigServiceClientTest : public testing::Test {
}
private:
+ base::MessageLoopForIO message_loop_;
net::TestURLRequestContext context_;
net::MockClientSocketFactory mock_socket_factory_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
index 6dfb7b8..504d956 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
@@ -179,6 +179,7 @@ class DataReductionProxyConfigTest : public testing::Test {
}
private:
+ base::MessageLoopForIO message_loop_;
scoped_ptr<DataReductionProxyTestContext> test_context_;
scoped_ptr<TestDataReductionProxyParams> expected_params_;
};
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc
index d669dcd..9d9972b 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc
@@ -50,6 +50,7 @@ class DataReductionProxyConfiguratorTest : public testing::Test {
}
}
+ base::MessageLoop message_loop_;
scoped_ptr<DataReductionProxyTestContext> test_context_;
scoped_ptr<DataReductionProxyConfigurator> config_;
};
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc
index b4189e2..a7e2965 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc
@@ -131,6 +131,7 @@ class DataReductionProxyInterceptorTest : public testing::Test {
default_context_->Init();
}
+ base::MessageLoopForIO message_loop_;
scoped_ptr<DataReductionProxyTestContext> test_context_;
net::TestNetworkDelegate default_network_delegate_;
scoped_ptr<net::URLRequestJobFactory> job_factory_;
@@ -235,6 +236,7 @@ class DataReductionProxyInterceptorWithServerTest : public testing::Test {
}
private:
+ base::MessageLoopForIO message_loop_;
net::TestNetLog net_log_;
net::TestNetworkDelegate network_delegate_;
net::TestURLRequestContext context_;
@@ -329,6 +331,7 @@ class DataReductionProxyInterceptorEndToEndTest : public testing::Test {
}
private:
+ base::MessageLoopForIO message_loop_;
net::TestDelegate delegate_;
net::MockClientSocketFactory mock_socket_factory_;
net::TestURLRequestContext context_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc
index be48a2a..5c44a5f 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc
@@ -26,6 +26,7 @@ namespace data_reduction_proxy {
TEST(ChromeNetworkDailyDataSavingMetricsTest,
GetDataReductionProxyRequestType) {
+ base::MessageLoopForIO message_loop;
scoped_ptr<DataReductionProxyTestContext> test_context =
DataReductionProxyTestContext::Builder()
.WithParamsFlags(DataReductionProxyParams::kAllowed)
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
index c96c862..b35c401 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -147,6 +147,7 @@ class DataReductionProxyNetworkDelegateTest : public testing::Test {
data_reduction_proxy_network_delegate_;
private:
+ base::MessageLoopForIO message_loop_;
net::TestURLRequestContext context_;
net::TestDelegate delegate_;
// |test_job_interceptor_| is owned by |test_job_factory_|.
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
index 4ea8a9a..eb7f5b5 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
@@ -174,6 +174,7 @@ class DataReductionProxyRequestOptionsTest : public testing::Test {
EXPECT_EQ(expected_header, header_value);
}
+ base::MessageLoopForIO message_loop_;
scoped_ptr<TestDataReductionProxyRequestOptions> request_options_;
scoped_ptr<DataReductionProxyTestContext> test_context_;
};
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h
index 3df3671..dc5ec7f 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h
@@ -83,6 +83,7 @@ class DataReductionProxySettingsTestBase : public testing::Test {
return true;
}
+ base::MessageLoopForIO message_loop_;
scoped_ptr<DataReductionProxyTestContext> test_context_;
scoped_ptr<DataReductionProxySettings> settings_;
base::Time last_update_time_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
index dce4f0a..0bcc780 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
@@ -143,6 +143,7 @@ TEST_F(DataReductionProxySettingsTest, TestContentLengths) {
}
TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) {
+ base::MessageLoopForIO message_loop;
struct TestCase {
const char* response_headers;
const char* response_body;
@@ -215,6 +216,7 @@ TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) {
}
TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) {
+ base::MessageLoopForIO message_loop;
scoped_ptr<DataReductionProxyTestContext> drp_test_context =
DataReductionProxyTestContext::Builder()
.WithParamsFlags(DataReductionProxyParams::kAllowed |
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc
index f070f13..c784796 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc
@@ -4,7 +4,6 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h"
-#include "base/message_loop/message_loop.h"
#include "base/prefs/testing_pref_service.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h"
@@ -293,7 +292,6 @@ scoped_ptr<DataReductionProxyTestContext>
DataReductionProxyTestContext::Builder::Build() {
// Check for invalid builder combinations.
DCHECK(!(use_mock_config_ && use_config_client_));
- scoped_ptr<base::MessageLoopForIO> loop(new base::MessageLoopForIO());
unsigned int test_context_flags = 0;
scoped_refptr<base::SingleThreadTaskRunner> task_runner =
@@ -394,7 +392,7 @@ DataReductionProxyTestContext::Builder::Build() {
scoped_ptr<DataReductionProxyTestContext> test_context(
new DataReductionProxyTestContext(
- loop.Pass(), task_runner, pref_service.Pass(), net_log.Pass(),
+ task_runner, pref_service.Pass(), net_log.Pass(),
request_context_getter, mock_socket_factory_, io_data.Pass(),
settings.Pass(), storage_delegate.Pass(), raw_params,
test_context_flags));
@@ -406,7 +404,6 @@ DataReductionProxyTestContext::Builder::Build() {
}
DataReductionProxyTestContext::DataReductionProxyTestContext(
- scoped_ptr<base::MessageLoop> loop,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_ptr<TestingPrefServiceSimple> simple_pref_service,
scoped_ptr<net::TestNetLog> net_log,
@@ -418,7 +415,6 @@ DataReductionProxyTestContext::DataReductionProxyTestContext(
TestDataReductionProxyParams* params,
unsigned int test_context_flags)
: test_context_flags_(test_context_flags),
- loop_(loop.Pass()),
task_runner_(task_runner),
simple_pref_service_(simple_pref_service.Pass()),
net_log_(net_log.Pass()),
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h
index e5c4ca0..e199098 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h
@@ -386,7 +386,6 @@ class DataReductionProxyTestContext {
};
DataReductionProxyTestContext(
- scoped_ptr<base::MessageLoop> loop,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_ptr<TestingPrefServiceSimple> simple_pref_service,
scoped_ptr<net::TestNetLog> net_log,
@@ -405,8 +404,6 @@ class DataReductionProxyTestContext {
unsigned int test_context_flags_;
- scoped_ptr<base::MessageLoop> loop_;
-
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_ptr<TestingPrefServiceSimple> simple_pref_service_;
scoped_ptr<net::TestNetLog> net_log_;
diff --git a/components/search_engines/template_url_service_sync_unittest.cc b/components/search_engines/template_url_service_sync_unittest.cc
index f0bfd85..d7baad5 100644
--- a/components/search_engines/template_url_service_sync_unittest.cc
+++ b/components/search_engines/template_url_service_sync_unittest.cc
@@ -4,7 +4,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
-#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -18,6 +17,7 @@
#include "components/search_engines/template_url_prepopulate_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_client.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "net/base/net_util.h"
#include "sync/api/sync_change_processor_wrapper_for_test.h"
#include "sync/api/sync_error_factory.h"
@@ -237,7 +237,7 @@ class TemplateURLServiceSyncTest : public testing::Test {
const std::string& guid);
protected:
- base::MessageLoop message_loop_;
+ content::TestBrowserThreadBundle thread_bundle_;
// We keep two TemplateURLServices to test syncing between them.
scoped_ptr<TemplateURLServiceTestUtil> test_util_a_;
scoped_ptr<TemplateURLServiceTestUtil> test_util_b_;
diff --git a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc
index ab3814a..147aefa 100644
--- a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
#include "cc/test/test_context_provider.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "content/browser/compositor/buffer_queue.h"
@@ -156,6 +157,7 @@ class VideoCaptureBufferPoolTest
new Buffer(pool_, buffer_handle.Pass(), buffer_id));
}
+ base::MessageLoop loop_;
int expected_dropped_id_;
scoped_refptr<VideoCaptureBufferPool> pool_;
diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h
index 029b70e..e4eb93d 100644
--- a/content/public/test/test_renderer_host.h
+++ b/content/public/test/test_renderer_host.h
@@ -231,6 +231,9 @@ class RenderViewHostTestHarness : public testing::Test {
void SetRenderProcessHostFactory(RenderProcessHostFactory* factory);
private:
+ int thread_bundle_options_;
+ scoped_ptr<TestBrowserThreadBundle> thread_bundle_;
+
scoped_ptr<ContentBrowserSanityChecker> sanity_checker_;
scoped_ptr<BrowserContext> browser_context_;
@@ -244,9 +247,6 @@ class RenderViewHostTestHarness : public testing::Test {
#endif
RenderViewHostTestEnabler rvh_test_enabler_;
- int thread_bundle_options_;
- scoped_ptr<TestBrowserThreadBundle> thread_bundle_;
-
DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness);
};
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc
index 3808644..b5a6c9e 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -735,7 +735,9 @@ void SimpleBackendImpl::DoomEntriesComplete(
// static
void SimpleBackendImpl::FlushWorkerPoolForTesting() {
- g_sequenced_worker_pool.Get().FlushForTesting();
+ // We only need to do this if we there is an active task runner.
+ if (base::ThreadTaskRunnerHandle::IsSet())
+ g_sequenced_worker_pool.Get().FlushForTesting();
}
} // namespace disk_cache