Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2436)

Unified Diff: chromeos/network/shill_property_handler_unittest.cc

Issue 2314853004: Remove calls to deprecated MessageLoop methods in chromeos. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/network/shill_property_handler_unittest.cc
diff --git a/chromeos/network/shill_property_handler_unittest.cc b/chromeos/network/shill_property_handler_unittest.cc
index 101bb20652d8936e50e85f0b50c2825410c96f8b..15434766b671ad9a72213ff2a17d13170fadc4f8 100644
--- a/chromeos/network/shill_property_handler_unittest.cc
+++ b/chromeos/network/shill_property_handler_unittest.cc
@@ -14,6 +14,7 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "base/values.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/shill_device_client.h"
@@ -187,7 +188,7 @@ class ShillPropertyHandlerTest : public testing::Test {
DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface();
ASSERT_TRUE(profile_test_);
SetupShillPropertyHandler();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
void TearDown() override {
@@ -273,7 +274,7 @@ class ShillPropertyHandlerTest : public testing::Test {
protected:
void SetupDefaultShillState() {
- message_loop_.RunUntilIdle(); // Process any pending updates
+ base::RunLoop().RunUntilIdle(); // Process any pending updates
device_test_->ClearDevices();
AddDevice(shill::kTypeWifi, "stub_wifi_device1");
AddDevice(shill::kTypeCellular, "stub_cellular_device1");
@@ -316,13 +317,13 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerTechnologyChanged) {
// Remove an enabled technology. Updates both the Available and Enabled lists.
listener_->reset_list_updates();
manager_test_->RemoveTechnology(shill::kTypeWifi);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(2, listener_->technology_list_updates());
// Add a disabled technology.
listener_->reset_list_updates();
manager_test_->AddTechnology(shill::kTypeWifi, false);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->technology_list_updates());
EXPECT_TRUE(shill_property_handler_->IsTechnologyAvailable(
shill::kTypeWifi));
@@ -333,7 +334,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerTechnologyChanged) {
DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology(
shill::kTypeWifi,
base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->technology_list_updates());
EXPECT_TRUE(shill_property_handler_->IsTechnologyEnabled(shill::kTypeWifi));
@@ -348,7 +349,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerDevicePropertyChanged) {
listener_->reset_list_updates();
const std::string kTestDevicePath("test_wifi_device1");
AddDevice(shill::kTypeWifi, kTestDevicePath);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->list_updates(shill::kDevicesProperty));
EXPECT_EQ(kNumShillManagerClientStubImplDevices + 1,
listener_->entries(shill::kDevicesProperty).size());
@@ -356,7 +357,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerDevicePropertyChanged) {
// Remove a device
listener_->reset_list_updates();
RemoveDevice(kTestDevicePath);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->list_updates(shill::kDevicesProperty));
EXPECT_EQ(kNumShillManagerClientStubImplDevices,
listener_->entries(shill::kDevicesProperty).size());
@@ -373,7 +374,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerServicePropertyChanged) {
listener_->reset_list_updates();
const std::string kTestServicePath("test_wifi_service1");
AddService(shill::kTypeWifi, kTestServicePath, shill::kStateIdle);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Add should trigger a service list update and update entries.
EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty));
EXPECT_EQ(kNumShillManagerClientStubImplServices + 1,
@@ -388,7 +389,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerServicePropertyChanged) {
shill::kScanIntervalProperty,
scan_interval,
base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Property change triggers an update (but not a service list update).
EXPECT_EQ(1, listener_->property_updates(
shill::kServiceCompleteListProperty)[kTestServicePath]);
@@ -401,14 +402,14 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerServicePropertyChanged) {
shill::kVisibleProperty,
base::FundamentalValue(false),
base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty));
// Remove a service. This will update the entries and signal a service list
// update.
listener_->reset_list_updates();
RemoveService(kTestServicePath);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty));
EXPECT_EQ(kNumShillManagerClientStubImplServices,
listener_->entries(shill::kServiceCompleteListProperty).size());
@@ -442,13 +443,13 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerIPConfigPropertyChanged) {
dbus::ObjectPath(kTestIPConfigPath),
shill::kGatewayProperty, gateway,
base::Bind(&DoNothingWithCallStatus));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Add a service with an empty ipconfig and then update
// its ipconfig property.
const std::string kTestServicePath1("test_wifi_service1");
AddService(shill::kTypeWifi, kTestServicePath1, shill::kStateIdle);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// This is the initial property update.
EXPECT_EQ(1, listener_->initial_property_updates(
shill::kServiceCompleteListProperty)[kTestServicePath1]);
@@ -457,7 +458,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerIPConfigPropertyChanged) {
shill::kIPConfigProperty,
base::StringValue(kTestIPConfigPath),
base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// IPConfig property change on the service should trigger an IPConfigs update.
EXPECT_EQ(1, listener_->property_updates(
shill::kIPConfigsProperty)[kTestIPConfigPath]);
@@ -466,7 +467,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerIPConfigPropertyChanged) {
const std::string kTestServicePath2("test_wifi_service2");
AddServiceWithIPConfig(shill::kTypeWifi, kTestServicePath2,
shill::kStateIdle, kTestIPConfigPath);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// A service with the IPConfig property already set should trigger an
// additional IPConfigs update.
EXPECT_EQ(2, listener_->property_updates(
@@ -477,13 +478,13 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerServiceList) {
// Add an entry to the profile only.
const std::string kTestServicePath1("stub_wifi_profile_only1");
AddServiceToProfile(shill::kTypeWifi, kTestServicePath1, false /* visible */);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Update the Manager properties. This should trigger a single list update,
// an initial property update, and a regular property update.
listener_->reset_list_updates();
shill_property_handler_->UpdateManagerProperties();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty));
EXPECT_EQ(1, listener_->initial_property_updates(
shill::kServiceCompleteListProperty)[kTestServicePath1]);
@@ -496,7 +497,7 @@ TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerServiceList) {
const std::string kTestServicePath2("stub_wifi_profile_only2");
AddServiceToProfile(shill::kTypeWifi, kTestServicePath2, true);
shill_property_handler_->UpdateManagerProperties();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty));
EXPECT_EQ(1, listener_->initial_property_updates(
shill::kServiceCompleteListProperty)[kTestServicePath2]);
@@ -511,7 +512,7 @@ TEST_F(ShillPropertyHandlerTest, ProhibitedTechnologies) {
shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet));
shill_property_handler_->SetProhibitedTechnologies(
prohibited_technologies, network_handler::ErrorCallback());
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Disabled
EXPECT_FALSE(
shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet));
@@ -519,7 +520,7 @@ TEST_F(ShillPropertyHandlerTest, ProhibitedTechnologies) {
// Can not enable it back
shill_property_handler_->SetTechnologyEnabled(
shill::kTypeEthernet, true, network_handler::ErrorCallback());
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_FALSE(
shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet));
@@ -529,7 +530,7 @@ TEST_F(ShillPropertyHandlerTest, ProhibitedTechnologies) {
prohibited_technologies, network_handler::ErrorCallback());
shill_property_handler_->SetTechnologyEnabled(
shill::kTypeEthernet, true, network_handler::ErrorCallback());
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_TRUE(
shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet));
}

Powered by Google App Engine
This is Rietveld 408576698