| Index: chromeos/network/network_device_handler_unittest.cc
|
| diff --git a/chromeos/network/network_device_handler_unittest.cc b/chromeos/network/network_device_handler_unittest.cc
|
| index 633d55591b8a00877ff654d87a32d972aba186a7..0d741f4a9eaa5944c5359148f8462bef051a01ab 100644
|
| --- a/chromeos/network/network_device_handler_unittest.cc
|
| +++ b/chromeos/network/network_device_handler_unittest.cc
|
| @@ -7,6 +7,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/fake_shill_device_client.h"
|
| @@ -66,7 +67,7 @@ class NetworkDeviceHandlerTest : public testing::Test {
|
| device_test->SetDeviceProperty(
|
| kDefaultWifiDevicePath, shill::kIPConfigsProperty, test_ip_configs);
|
|
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| void TearDown() override {
|
| @@ -116,7 +117,7 @@ class NetworkDeviceHandlerTest : public testing::Test {
|
| TEST_F(NetworkDeviceHandlerTest, GetDeviceProperties) {
|
| network_device_handler_->GetDeviceProperties(
|
| kDefaultWifiDevicePath, properties_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
| std::string type;
|
| properties_->GetString(shill::kTypeProperty, &type);
|
| @@ -131,14 +132,14 @@ TEST_F(NetworkDeviceHandlerTest, SetDeviceProperty) {
|
| base::FundamentalValue(1),
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
|
|
| // GetDeviceProperties should return the value set by SetDeviceProperty.
|
| network_device_handler_->GetDeviceProperties(kDefaultCellularDevicePath,
|
| properties_success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
| int interval = 0;
|
| EXPECT_TRUE(properties_->GetIntegerWithoutPathExpansion(
|
| @@ -151,13 +152,13 @@ TEST_F(NetworkDeviceHandlerTest, SetDeviceProperty) {
|
| base::FundamentalValue(2),
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
|
|
| network_device_handler_->GetDeviceProperties(kDefaultCellularDevicePath,
|
| properties_success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
| EXPECT_TRUE(properties_->GetIntegerWithoutPathExpansion(
|
| shill::kScanIntervalProperty, &interval));
|
| @@ -169,7 +170,7 @@ TEST_F(NetworkDeviceHandlerTest, SetDeviceProperty) {
|
| base::FundamentalValue(1),
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_);
|
|
|
| // Setting a owner-protected device property through SetDeviceProperty must
|
| @@ -180,7 +181,7 @@ TEST_F(NetworkDeviceHandlerTest, SetDeviceProperty) {
|
| base::FundamentalValue(true),
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_NE(kResultSuccess, result_);
|
|
|
| }
|
| @@ -194,13 +195,13 @@ TEST_F(NetworkDeviceHandlerTest, CellularAllowRoaming) {
|
| base::FundamentalValue(false));
|
|
|
| network_device_handler_->SetCellularAllowRoaming(true);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Roaming should be enabled now.
|
| network_device_handler_->GetDeviceProperties(kDefaultCellularDevicePath,
|
| properties_success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
| bool allow_roaming;
|
| EXPECT_TRUE(properties_->GetBooleanWithoutPathExpansion(
|
| @@ -208,13 +209,13 @@ TEST_F(NetworkDeviceHandlerTest, CellularAllowRoaming) {
|
| EXPECT_TRUE(allow_roaming);
|
|
|
| network_device_handler_->SetCellularAllowRoaming(false);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Roaming should be disable again.
|
| network_device_handler_->GetDeviceProperties(kDefaultCellularDevicePath,
|
| properties_success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
| EXPECT_TRUE(properties_->GetBooleanWithoutPathExpansion(
|
| shill::kCellularAllowRoamingProperty, &allow_roaming));
|
| @@ -227,7 +228,7 @@ TEST_F(NetworkDeviceHandlerTest, SetWifiTDLSEnabled) {
|
| shill::kTDLSConnectedState);
|
| network_device_handler_->SetWifiTDLSEnabled(
|
| "fake_ip_address", true, string_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(shill::kTDLSConnectedState, result_);
|
| }
|
|
|
| @@ -238,17 +239,17 @@ TEST_F(NetworkDeviceHandlerTest, SetWifiTDLSEnabledNonexistent) {
|
| shill::kTDLSNonexistentState);
|
| network_device_handler_->SetWifiTDLSEnabled(
|
| "fake_ip_address", true, string_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(shill::kTDLSNonexistentState, result_);
|
| }
|
|
|
| TEST_F(NetworkDeviceHandlerTest, SetWifiTDLSEnabledMissing) {
|
| // Remove the wifi device. Call should fail with "device missing" error.
|
| fake_device_client_->GetTestInterface()->RemoveDevice(kDefaultWifiDevicePath);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| network_device_handler_->SetWifiTDLSEnabled(
|
| "fake_ip_address", true, string_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_);
|
| }
|
|
|
| @@ -259,7 +260,7 @@ TEST_F(NetworkDeviceHandlerTest, SetWifiTDLSEnabledBusy) {
|
| fake_device_client_->GetTestInterface()->SetTDLSBusyCount(1);
|
| network_device_handler_->SetWifiTDLSEnabled(
|
| "fake_ip_address", true, string_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(shill::kTDLSConnectedState, result_);
|
|
|
| // Set the busy count to a large number, call should fail after max number
|
| @@ -267,7 +268,7 @@ TEST_F(NetworkDeviceHandlerTest, SetWifiTDLSEnabledBusy) {
|
| fake_device_client_->GetTestInterface()->SetTDLSBusyCount(100000);
|
| network_device_handler_->SetWifiTDLSEnabled(
|
| "fake_ip_address", true, string_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorTimeout, result_);
|
| }
|
|
|
| @@ -277,22 +278,22 @@ TEST_F(NetworkDeviceHandlerTest, GetWifiTDLSStatus) {
|
| shill::kTDLSConnectedState);
|
| network_device_handler_->GetWifiTDLSStatus(
|
| "fake_ip_address", string_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(shill::kTDLSConnectedState, result_);
|
|
|
| // Remove the wifi device. Call should fail with "device missing" error.
|
| fake_device_client_->GetTestInterface()->RemoveDevice(kDefaultWifiDevicePath);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| network_device_handler_->GetWifiTDLSStatus(
|
| "fake_ip_address", string_success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_);
|
| }
|
|
|
| TEST_F(NetworkDeviceHandlerTest, RequestRefreshIPConfigs) {
|
| network_device_handler_->RequestRefreshIPConfigs(
|
| kDefaultWifiDevicePath, success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
| // TODO(stevenjb): Add test interface to ShillIPConfigClient and test
|
| // refresh calls.
|
| @@ -304,13 +305,13 @@ TEST_F(NetworkDeviceHandlerTest, SetCarrier) {
|
| // Test that the success callback gets called.
|
| network_device_handler_->SetCarrier(
|
| kDefaultCellularDevicePath, kCarrier, success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
|
|
| // Test that the shill error propagates to the error callback.
|
| network_device_handler_->SetCarrier(
|
| kUnknownCellularDevicePath, kCarrier, success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_);
|
| }
|
|
|
| @@ -321,7 +322,7 @@ TEST_F(NetworkDeviceHandlerTest, RequirePin) {
|
| kDefaultPin,
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
|
|
| // Test that the shill error propagates to the error callback.
|
| @@ -330,7 +331,7 @@ TEST_F(NetworkDeviceHandlerTest, RequirePin) {
|
| kDefaultPin,
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_);
|
| }
|
|
|
| @@ -340,7 +341,7 @@ TEST_F(NetworkDeviceHandlerTest, EnterPin) {
|
| kDefaultPin,
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
|
|
| // Test that the shill error propagates to the error callback.
|
| @@ -348,7 +349,7 @@ TEST_F(NetworkDeviceHandlerTest, EnterPin) {
|
| kDefaultPin,
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_);
|
| }
|
|
|
| @@ -362,7 +363,7 @@ TEST_F(NetworkDeviceHandlerTest, UnblockPin) {
|
| kPuk,
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
|
|
| // Test that the shill error propagates to the error callback.
|
| @@ -371,7 +372,7 @@ TEST_F(NetworkDeviceHandlerTest, UnblockPin) {
|
| kPuk,
|
| success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_);
|
| }
|
|
|
| @@ -385,14 +386,14 @@ TEST_F(NetworkDeviceHandlerTest, ChangePin) {
|
| network_device_handler_->ChangePin(
|
| kDefaultCellularDevicePath, FakeShillDeviceClient::kDefaultSimPin,
|
| kNewPin, success_callback_, error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(kResultSuccess, result_);
|
|
|
| // Test that the shill error propagates to the error callback.
|
| network_device_handler_->ChangePin(kDefaultCellularDevicePath, kIncorrectPin,
|
| kNewPin, success_callback_,
|
| error_callback_);
|
| - message_loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(NetworkDeviceHandler::kErrorIncorrectPin, result_);
|
| }
|
|
|
|
|