Skip to content

Commit

Permalink
MessageLoop(TYPE_UI) -> MessageLoopForUI
Browse files Browse the repository at this point in the history
Converts creation of MessageLoopForUI from MessageLoop(TYPE_UI) to
MessageLoopForUI.

This is a step in the direction of moving type out of MessageLoop.

BUG=none
TEST=none
R=darin@chromium.org

Review URL: https://codereview.chromium.org/108713004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241917 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sky@chromium.org committed Dec 19, 2013
1 parent 030a480 commit 166f2ed
Show file tree
Hide file tree
Showing 54 changed files with 78 additions and 102 deletions.
2 changes: 1 addition & 1 deletion android_webview/browser/aw_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void AwBrowserMainParts::PreEarlyInitialization() {
// Android WebView does not use default MessageLoop. It has its own
// Android specific MessageLoop. Also see MainMessageLoopRun.
DCHECK(!main_message_loop_.get());
main_message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
main_message_loop_.reset(new base::MessageLoopForUI);
base::MessageLoopForUI::current()->Start();
}

Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/autofill/risk/fingerprint_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class AutofillRiskFingerprintTest : public InProcessBrowserTest {
content_bounds_(11, 13, 17, 37),
screen_bounds_(0, 0, 101, 71),
available_screen_bounds_(0, 11, 101, 60),
unavailable_screen_bounds_(0, 0, 101, 11),
message_loop_(base::MessageLoop::TYPE_UI) {}
unavailable_screen_bounds_(0, 0, 101, 11) {}

void GetFingerprintTestCallback(scoped_ptr<Fingerprint> fingerprint) {
// Verify that all fields Chrome can fill have been filled.
Expand Down Expand Up @@ -167,7 +166,7 @@ class AutofillRiskFingerprintTest : public InProcessBrowserTest {
const gfx::Rect unavailable_screen_bounds_;

// A message loop to block on the asynchronous loading of the fingerprint.
base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
};

// Test that getting a fingerprint works on some basic level.
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chrome_browser_main_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void ChromeBrowserMainPartsAndroid::PreEarlyInitialization() {
{
TRACE_EVENT0("startup",
"ChromeBrowserMainPartsAndroid::PreEarlyInitialization:CreateUiMsgLoop");
main_message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
main_message_loop_.reset(new base::MessageLoopForUI);
}

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ class FakeDBusData {
class AttestationPolicyObserverTest : public ::testing::Test {
public:
AttestationPolicyObserverTest()
: message_loop_(base::MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &message_loop_) {
: ui_thread_(content::BrowserThread::UI, &message_loop_) {
// Remove the real DeviceSettingsProvider and replace it with a stub.
CrosSettings* cros_settings = CrosSettings::Get();
device_settings_provider_ =
Expand Down Expand Up @@ -167,7 +166,7 @@ class AttestationPolicyObserverTest : public ::testing::Test {
return serialized;
}

base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
ScopedTestDeviceSettingsService test_device_settings_service_;
ScopedTestCrosSettings test_cros_settings_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ class CustomFakeCryptohomeClient : public FakeCryptohomeClient {
class PlatformVerificationFlowTest : public ::testing::Test {
public:
PlatformVerificationFlowTest()
: message_loop_(base::MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &message_loop_),
: ui_thread_(content::BrowserThread::UI, &message_loop_),
certificate_success_(true),
fake_certificate_index_(0),
sign_challenge_success_(true),
Expand Down Expand Up @@ -306,7 +305,7 @@ class PlatformVerificationFlowTest : public ::testing::Test {
}

protected:
base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
StrictMock<MockAttestationFlow> mock_attestation_flow_;
cryptohome::MockAsyncMethodCaller mock_async_caller_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ namespace chromeos {
class KioskModeSettingsTest : public testing::Test {
protected:
KioskModeSettingsTest()
: message_loop_(base::MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &message_loop_),
: ui_thread_(content::BrowserThread::UI, &message_loop_),
file_thread_(content::BrowserThread::FILE, &message_loop_) {
CrosSettings* cros_settings = CrosSettings::Get();

Expand Down Expand Up @@ -70,7 +69,7 @@ class KioskModeSettingsTest : public testing::Test {
KioskModeSettings::Get()->set_initialized(false);
}

base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class ExistingUserControllerAutoLoginTest : public ::testing::Test {
: auto_login_user_id_(policy::GenerateDeviceLocalAccountUserId(
kAutoLoginAccountId,
policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION)),
message_loop_(base::MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &message_loop_),
local_state_(TestingBrowserProcess::GetGlobal()),
mock_user_manager_(new MockUserManager()),
Expand Down Expand Up @@ -150,7 +149,7 @@ class ExistingUserControllerAutoLoginTest : public ::testing::Test {
MockLoginDisplay* mock_login_display_;

scoped_ptr<MockLoginDisplayHost> mock_login_display_host_;
base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
ScopedTestingLocalState local_state_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ namespace policy {
class DeviceStatusCollectorTest : public testing::Test {
public:
DeviceStatusCollectorTest()
: message_loop_(base::MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &message_loop_),
: ui_thread_(content::BrowserThread::UI, &message_loop_),
file_thread_(content::BrowserThread::FILE, &message_loop_),
io_thread_(content::BrowserThread::IO, &message_loop_),
user_manager_(new chromeos::MockUserManager()),
Expand Down Expand Up @@ -257,7 +256,7 @@ class DeviceStatusCollectorTest : public testing::Test {
// Since this is a unit test running in browser_tests we must do additional
// unit test setup and make a TestingBrowserProcess. Must be first member.
TestingBrowserProcessInitializer initializer_;
base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
content::TestBrowserThread io_thread_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ ACTION_P2(SendSanitizedUsername, call_status, sanitized_username) {

class UserCloudPolicyStoreChromeOSTest : public testing::Test {
protected:
UserCloudPolicyStoreChromeOSTest()
: loop_(base::MessageLoop::TYPE_UI) {}
UserCloudPolicyStoreChromeOSTest() {}

virtual void SetUp() OVERRIDE {
EXPECT_CALL(cryptohome_client_,
Expand Down Expand Up @@ -220,7 +219,7 @@ class UserCloudPolicyStoreChromeOSTest : public testing::Test {
return tmp_dir_.path().AppendASCII("policy");
}

base::MessageLoop loop_;
base::MessageLoopForUI loop_;
chromeos::MockCryptohomeClient cryptohome_client_;
chromeos::MockSessionManagerClient session_manager_client_;
UserPolicyBuilder policy_;
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/chromeos/settings/cros_settings_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ namespace chromeos {
class CrosSettingsTest : public testing::Test {
protected:
CrosSettingsTest()
: message_loop_(base::MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &message_loop_),
: ui_thread_(content::BrowserThread::UI, &message_loop_),
local_state_(TestingBrowserProcess::GetGlobal()),
settings_(DeviceSettingsService::Get()),
weak_factory_(this) {}
Expand Down Expand Up @@ -89,7 +88,7 @@ class CrosSettingsTest : public testing::Test {
response.set_policy_data_signature("false");
}

base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;

ScopedTestingLocalState local_state_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ ScopedDeviceSettingsTestHelper::~ScopedDeviceSettingsTestHelper() {
}

DeviceSettingsTestBase::DeviceSettingsTestBase()
: loop_(base::MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &loop_),
: ui_thread_(content::BrowserThread::UI, &loop_),
file_thread_(content::BrowserThread::FILE, &loop_),
owner_key_util_(new MockOwnerKeyUtil()) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class DeviceSettingsTestBase : public testing::Test {
// |device_settings_service_| and flushes the resulting load operation.
void ReloadDeviceSettings();

base::MessageLoop loop_;
base::MessageLoopForUI loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SystemMemoryApiTest: public ExtensionApiTest {

virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
message_loop_.reset(new base::MessageLoopForUI);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SystemStorageApiTest : public ExtensionApiTest {

virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
message_loop_.reset(new base::MessageLoopForUI);
}

void SetUpAllMockStorageDevices() {
Expand Down
6 changes: 2 additions & 4 deletions chrome/browser/extensions/user_script_master_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ namespace extensions {
class UserScriptMasterTest : public testing::Test,
public content::NotificationObserver {
public:
UserScriptMasterTest()
: message_loop_(base::MessageLoop::TYPE_UI),
shared_memory_(NULL) {
UserScriptMasterTest() : shared_memory_(NULL) {
}

virtual void SetUp() {
Expand Down Expand Up @@ -80,7 +78,7 @@ class UserScriptMasterTest : public testing::Test,
content::NotificationRegistrar registrar_;

// MessageLoop used in tests.
base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;

scoped_ptr<content::TestBrowserThread> file_thread_;
scoped_ptr<content::TestBrowserThread> ui_thread_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void DataReductionProxySettingsTestBase::CheckOnPrefChange(
void DataReductionProxySettingsTestBase::CheckInitDataReductionProxy(
bool enabled_at_startup) {
AddProxyToCommandLine();
base::MessageLoop loop(base::MessageLoop::TYPE_UI);
base::MessageLoopForUI loop;
pref_service_.SetBoolean(prefs::kSpdyProxyAuthEnabled, enabled_at_startup);
SetProbeResult(
kProbeURLWithOKResponse, "OK", true, enabled_at_startup ? 1 : 0);
Expand Down Expand Up @@ -477,7 +477,7 @@ TEST_F(DataReductionProxySettingsTest, TestMaybeActivateDataReductionProxy) {
settings_->GetOriginalProfilePrefs());

// TODO(bengr): Test enabling/disabling while a probe is outstanding.
base::MessageLoop loop(base::MessageLoop::TYPE_UI);
base::MessageLoopForUI loop;
// The proxy is enabled and unrestructed initially.
// Request succeeded but with bad response, expect proxy to be restricted.
CheckProbe(true, kProbeURLWithBadResponse, "Bad", true, true, true);
Expand All @@ -492,7 +492,7 @@ TEST_F(DataReductionProxySettingsTest, TestMaybeActivateDataReductionProxy) {

TEST_F(DataReductionProxySettingsTest, TestOnIPAddressChanged) {
AddProxyToCommandLine();
base::MessageLoop loop(base::MessageLoop::TYPE_UI);
base::MessageLoopForUI loop;
// The proxy is enabled initially.
settings_->enabled_by_user_ = true;
settings_->restricted_by_carrier_ = false;
Expand All @@ -511,7 +511,7 @@ TEST_F(DataReductionProxySettingsTest, TestOnIPAddressChanged) {
TEST_F(DataReductionProxySettingsTest, TestOnProxyEnabledPrefChange) {
AddProxyToCommandLine();
settings_->InitPrefMembers();
base::MessageLoop loop(base::MessageLoop::TYPE_UI);
base::MessageLoopForUI loop;
// The proxy is enabled initially.
settings_->enabled_by_user_ = true;
settings_->SetProxyConfigs(true, false, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class SpellcheckMacTest: public testing::Test {
SpellcheckMacTest()
: callback_(base::Bind(&SpellcheckMacTest::CompletionCallback,
base::Unretained(this))),
callback_finished_(false),
message_loop_(base::MessageLoop::TYPE_UI) {}
callback_finished_(false) {}

void WaitForCallback() {
content::RunMessageLoop();
Expand All @@ -43,7 +42,7 @@ class SpellcheckMacTest: public testing::Test {
base::Unretained(this)));
}

base::MessageLoop message_loop_;
base::MessageLoopForUI message_loop_;
spellcheck_mac::ScopedEnglishLanguageForTest scoped_language_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class SyncGenericChangeProcessorTest : public testing::Test {
static const syncer::ModelType kType = syncer::PREFERENCES;

SyncGenericChangeProcessorTest() :
loop_(base::MessageLoop::TYPE_UI),
sync_merge_result_(kType),
merge_result_ptr_factory_(&sync_merge_result_),
syncable_service_ptr_factory_(&fake_syncable_service_) {
Expand Down Expand Up @@ -78,7 +77,7 @@ class SyncGenericChangeProcessorTest : public testing::Test {
}

private:
base::MessageLoop loop_;
base::MessageLoopForUI loop_;

syncer::SyncMergeResult sync_merge_result_;
base::WeakPtrFactory<syncer::SyncMergeResult> merge_result_ptr_factory_;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/panels/panel_mouse_watcher_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PanelMouseWatcherTest : public testing::Test {
};

TEST_F(PanelMouseWatcherTest, StartStopWatching) {
base::MessageLoop loop(base::MessageLoop::TYPE_UI);
base::MessageLoopForUI loop;

scoped_ptr<PanelMouseWatcher> watcher(PanelMouseWatcher::Create());
EXPECT_FALSE(watcher->IsActive());
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/ui/webui/fileicon_source_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ class TestFileIconSource : public FileIconSource {
class FileIconSourceTest : public testing::Test {
public:
FileIconSourceTest()
: loop_(base::MessageLoop::TYPE_UI),
ui_thread_(BrowserThread::UI, base::MessageLoop::current()),
: ui_thread_(BrowserThread::UI, base::MessageLoop::current()),
file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {}

static TestFileIconSource* CreateFileIconSource() {
return new TestFileIconSource();
}

private:
base::MessageLoop loop_;
base::MessageLoopForUI loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
};
Expand Down
2 changes: 1 addition & 1 deletion components/dom_distiller/core/distiller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ ACTION_P2(CreateMockDistillerPage, list, kurl) {
}

TEST_F(DistillerTest, DistillPage) {
base::MessageLoop loop(base::MessageLoop::TYPE_UI);
base::MessageLoopForUI loop;
scoped_ptr<base::ListValue> list(new base::ListValue());
list->AppendString(kTitle);
list->AppendString(kContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DistillerURLFetcherTest : public testing::Test {

void Fetch(const std::string& url,
const std::string& expected_response) {
base::MessageLoop loop(base::MessageLoop::TYPE_UI);
base::MessageLoopForUI loop;
url_fetcher_->FetchURL(
url,
base::Bind(&DistillerURLFetcherTest::FetcherCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ ACTION_P(CheckStatus, expected_status) {
class CloudPolicyValidatorTest : public testing::Test {
public:
CloudPolicyValidatorTest()
: loop_(base::MessageLoop::TYPE_UI),
timestamp_(base::Time::UnixEpoch() +
: timestamp_(base::Time::UnixEpoch() +
base::TimeDelta::FromMilliseconds(
PolicyBuilder::kFakeTimestamp)),
timestamp_option_(CloudPolicyValidatorBase::TIMESTAMP_REQUIRED),
Expand Down Expand Up @@ -89,7 +88,7 @@ class CloudPolicyValidatorTest : public testing::Test {
validator->payload()->SerializeAsString());
}

base::MessageLoop loop_;
base::MessageLoopForUI loop_;
base::Time timestamp_;
CloudPolicyValidatorBase::ValidateTimestampOption timestamp_option_;
CloudPolicyValidatorBase::ValidateDMTokenOption ignore_missing_dm_token_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void RunUntilIdle() {

class UserCloudPolicyStoreTest : public testing::Test {
public:
UserCloudPolicyStoreTest() : loop_(base::MessageLoop::TYPE_UI) {}
UserCloudPolicyStoreTest() {}

virtual void SetUp() OVERRIDE {
ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
Expand Down Expand Up @@ -89,7 +89,7 @@ class UserCloudPolicyStoreTest : public testing::Test {
// CloudPolicyValidator() requires a FILE thread so declare one here. Both
// |ui_thread_| and |file_thread_| share the same MessageLoop |loop_| so
// callers can use RunLoop to manage both virtual threads.
base::MessageLoop loop_;
base::MessageLoopForUI loop_;

base::ScopedTempDir tmp_dir_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SoftwareBrowserCompositorOutputSurfaceTest : public testing::Test {
SoftwareBrowserCompositorOutputSurfaceTest::
SoftwareBrowserCompositorOutputSurfaceTest() {
CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL));
message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
message_loop_.reset(new base::MessageLoopForUI);
}

SoftwareBrowserCompositorOutputSurfaceTest::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SoftwareOutputDeviceOzoneTest : public testing::Test {

SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() {
CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL));
message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
message_loop_.reset(new base::MessageLoopForUI);
}

SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() {
Expand Down
Loading

0 comments on commit 166f2ed

Please sign in to comment.