Skip to content

Commit

Permalink
Remove calls to deprecated MessageLoop methods in chromeos.
Browse files Browse the repository at this point in the history
This CL (hopefully) removes all calls to these methods in chromeos:
- MessageLoop::PostTask
- MessageLoop::PostDelayedTask
- MessageLoop::DeleteSoon
- MessageLoop::ReleaseSoon
- MessageLoop::Run
- MessageLoop::RunUntilIdle

BUG=616447
R=oshima@chromium.org

Review-Url: https://codereview.chromium.org/2314853004
Cr-Commit-Position: refs/heads/master@{#418234}
  • Loading branch information
fdoray authored and Commit bot committed Sep 13, 2016
1 parent 88f013b commit f5b47fd
Show file tree
Hide file tree
Showing 23 changed files with 264 additions and 252 deletions.
10 changes: 5 additions & 5 deletions chromeos/audio/cras_audio_handler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class CrasAudioHandlerTest : public testing::Test {
cras_audio_handler_ = CrasAudioHandler::Get();
test_observer_.reset(new TestObserver);
cras_audio_handler_->AddAudioObserver(test_observer_.get());
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

// Set up cras audio handlers with |audio_nodes| and set the active state of
Expand Down Expand Up @@ -369,7 +369,7 @@ class CrasAudioHandlerTest : public testing::Test {
cras_audio_handler_ = CrasAudioHandler::Get();
test_observer_.reset(new TestObserver);
cras_audio_handler_->AddAudioObserver(test_observer_.get());
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

void SetUpCrasAudioHandlerWithPrimaryActiveNode(
Expand All @@ -385,13 +385,13 @@ class CrasAudioHandlerTest : public testing::Test {
cras_audio_handler_ = CrasAudioHandler::Get();
test_observer_.reset(new TestObserver);
cras_audio_handler_->AddAudioObserver(test_observer_.get());
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

void ChangeAudioNodes(const AudioNodeList& audio_nodes) {
fake_cras_audio_client_->SetAudioNodesAndNotifyObserversForTesting(
audio_nodes);
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

const AudioDevice* GetDeviceFromId(uint64_t id) {
Expand Down Expand Up @@ -423,7 +423,7 @@ class CrasAudioHandlerTest : public testing::Test {

void RestartAudioClient() {
cras_audio_handler_->AudioClientRestarted();
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

protected:
Expand Down
41 changes: 21 additions & 20 deletions chromeos/dbus/cras_audio_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "dbus/message.h"
#include "dbus/mock_bus.h"
#include "dbus/mock_object_proxy.h"
Expand Down Expand Up @@ -306,7 +307,7 @@ class CrasAudioClientTest : public testing::Test {
client_.reset(CrasAudioClient::Create());
client_->Init(mock_bus_.get());
// Run the message loop to run the signal connection result callback.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

void TearDown() override { mock_bus_->ShutdownAndBlock(); }
Expand Down Expand Up @@ -539,7 +540,7 @@ TEST_F(CrasAudioClientTest, OutputMuteChanged) {
// Run the signal callback again and make sure the observer isn't called.
SendOutputMuteChangedSignal(&signal);

message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, InputMuteChanged) {
Expand Down Expand Up @@ -568,7 +569,7 @@ TEST_F(CrasAudioClientTest, InputMuteChanged) {
// Run the signal callback again and make sure the observer isn't called.
SendInputMuteChangedSignal(&signal);

message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, NodesChanged) {
Expand All @@ -593,7 +594,7 @@ TEST_F(CrasAudioClientTest, NodesChanged) {
// Run the signal callback again and make sure the observer isn't called.
SendNodesChangedSignal(&signal);

message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, ActiveOutputNodeChanged) {
Expand Down Expand Up @@ -621,7 +622,7 @@ TEST_F(CrasAudioClientTest, ActiveOutputNodeChanged) {
// Run the signal callback again and make sure the observer isn't called.
SendActiveOutputNodeChangedSignal(&signal);

message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, ActiveInputNodeChanged) {
Expand Down Expand Up @@ -649,7 +650,7 @@ TEST_F(CrasAudioClientTest, ActiveInputNodeChanged) {
// Run the signal callback again and make sure the observer isn't called.
SendActiveInputNodeChangedSignal(&signal);

message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, OutputNodeVolumeChanged) {
Expand Down Expand Up @@ -679,7 +680,7 @@ TEST_F(CrasAudioClientTest, OutputNodeVolumeChanged) {
// Run the signal callback again and make sure the observer isn't called.
SendOutputNodeVolumeChangedSignal(&signal);

message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, GetNodes) {
Expand All @@ -704,7 +705,7 @@ TEST_F(CrasAudioClientTest, GetNodes) {
error_callback.GetCallback());
EXPECT_CALL(error_callback, Run(_, _)).Times(0);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SetOutputNodeVolume) {
Expand All @@ -722,7 +723,7 @@ TEST_F(CrasAudioClientTest, SetOutputNodeVolume) {
// Call method.
client_->SetOutputNodeVolume(kNodeId, kVolume);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SetOutputUserMute) {
Expand All @@ -737,7 +738,7 @@ TEST_F(CrasAudioClientTest, SetOutputUserMute) {
// Call method.
client_->SetOutputUserMute(kUserMuteOn);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SetInputNodeGain) {
Expand All @@ -755,7 +756,7 @@ TEST_F(CrasAudioClientTest, SetInputNodeGain) {
// Call method.
client_->SetInputNodeGain(kNodeId, kInputGain);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SetInputMute) {
Expand All @@ -770,7 +771,7 @@ TEST_F(CrasAudioClientTest, SetInputMute) {
// Call method.
client_->SetInputMute(kInputMuteOn);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SetActiveOutputNode) {
Expand All @@ -785,7 +786,7 @@ TEST_F(CrasAudioClientTest, SetActiveOutputNode) {
// Call method.
client_->SetActiveOutputNode(kNodeId);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SetActiveInputNode) {
Expand All @@ -800,7 +801,7 @@ TEST_F(CrasAudioClientTest, SetActiveInputNode) {
// Call method.
client_->SetActiveInputNode(kNodeId);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, AddActiveInputNode) {
Expand All @@ -815,7 +816,7 @@ TEST_F(CrasAudioClientTest, AddActiveInputNode) {
// Call method.
client_->AddActiveInputNode(kNodeId);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, RemoveActiveInputNode) {
Expand All @@ -830,7 +831,7 @@ TEST_F(CrasAudioClientTest, RemoveActiveInputNode) {
// Call method.
client_->RemoveActiveInputNode(kNodeId);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, AddActiveOutputNode) {
Expand All @@ -845,7 +846,7 @@ TEST_F(CrasAudioClientTest, AddActiveOutputNode) {
// Call method.
client_->AddActiveOutputNode(kNodeId);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, RemoveActiveOutputNode) {
Expand All @@ -860,7 +861,7 @@ TEST_F(CrasAudioClientTest, RemoveActiveOutputNode) {
// Call method.
client_->RemoveActiveOutputNode(kNodeId);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SwapLeftRight) {
Expand All @@ -878,7 +879,7 @@ TEST_F(CrasAudioClientTest, SwapLeftRight) {
// Call method.
client_->SwapLeftRight(kNodeId, kSwap);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(CrasAudioClientTest, SetGlobalOutputChannelRemix) {
Expand All @@ -897,7 +898,7 @@ TEST_F(CrasAudioClientTest, SetGlobalOutputChannelRemix) {
// Call method.
client_->SetGlobalOutputChannelRemix(kChannels, kMixer);
// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

} // namespace chromeos
9 changes: 5 additions & 4 deletions chromeos/dbus/gsm_sms_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/values.h"
#include "dbus/message.h"
Expand Down Expand Up @@ -207,7 +208,7 @@ TEST_F(GsmSMSClientTest, SmsReceived) {
base::Unretained(&handler)));

// Run the message loop to run the signal connection result callback.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();

// Send signal.
dbus::Signal signal(modemmanager::kModemManagerSMSInterface,
Expand Down Expand Up @@ -240,7 +241,7 @@ TEST_F(GsmSMSClientTest, Delete) {
base::Unretained(&callback)));

// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(GsmSMSClientTest, Get) {
Expand Down Expand Up @@ -280,7 +281,7 @@ TEST_F(GsmSMSClientTest, Get) {
base::Bind(&MockGetCallback::Run, base::Unretained(&callback)));

// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(GsmSMSClientTest, List) {
Expand Down Expand Up @@ -323,7 +324,7 @@ TEST_F(GsmSMSClientTest, List) {
base::Unretained(&callback)));

// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

} // namespace chromeos
7 changes: 4 additions & 3 deletions chromeos/dbus/modem_messaging_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/values.h"
#include "dbus/message.h"
Expand Down Expand Up @@ -174,7 +175,7 @@ TEST_F(ModemMessagingClientTest, SmsReceived) {
base::Unretained(&handler)));

// Run the message loop to run the signal connection result callback.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();

// Send signal.
dbus::Signal signal(modemmanager::kModemManager1MessagingInterface,
Expand Down Expand Up @@ -207,7 +208,7 @@ TEST_F(ModemMessagingClientTest, Delete) {
base::Unretained(&callback)));

// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

TEST_F(ModemMessagingClientTest, List) {
Expand Down Expand Up @@ -237,7 +238,7 @@ TEST_F(ModemMessagingClientTest, List) {
base::Unretained(&callback)));

// Run the message loop.
message_loop_.RunUntilIdle();
base::RunLoop().RunUntilIdle();
}

} // namespace chromeos
3 changes: 2 additions & 1 deletion chromeos/dbus/services/service_provider_test_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <utility>

#include "base/bind.h"
#include "base/run_loop.h"
#include "dbus/message.h"
#include "dbus/mock_bus.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
Expand Down Expand Up @@ -133,7 +134,7 @@ dbus::Response* ServiceProviderTestHelper::MockCallMethodAndBlock(
base::Unretained(this)));
// Check for a response.
if (!response_received_)
base::MessageLoop::current()->Run();
base::RunLoop().Run();
// Return response.
return response_.release();
}
Expand Down
Loading

0 comments on commit f5b47fd

Please sign in to comment.