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

Unified Diff: chrome/browser/chromeos/cros/cros_network_functions_unittest.cc

Issue 10949030: This converts the Shill clients to allow propagation of shill errors (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix bad merge Created 8 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
« no previous file with comments | « chrome/browser/chromeos/cros/cros_network_functions.cc ('k') | chromeos/dbus/dbus_method_call_status.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/cros/cros_network_functions_unittest.cc
diff --git a/chrome/browser/chromeos/cros/cros_network_functions_unittest.cc b/chrome/browser/chromeos/cros/cros_network_functions_unittest.cc
index 357ff78a5d1762008b0a266291d2cfcd6fb5f1da..8ce527cc39f4a0b93c489e13d88ed37756382d2d 100644
--- a/chrome/browser/chromeos/cros/cros_network_functions_unittest.cc
+++ b/chrome/browser/chromeos/cros/cros_network_functions_unittest.cc
@@ -192,12 +192,22 @@ class CrosNetworkFunctionsTest : public testing::Test {
callback.Run(DBUS_METHOD_CALL_SUCCESS, *dictionary_value_result_);
}
+ // Handles responses for GetProperties method calls that return
+ // errors in an error callback.
+ void OnGetPropertiesWithoutStatus(
+ const dbus::ObjectPath& path,
+ const ShillClientHelper::DictionaryValueCallbackWithoutStatus& callback,
+ const ShillClientHelper::ErrorCallback& error_callback) {
+ callback.Run(*dictionary_value_result_);
+ }
+
// Handles responses for GetEntry method calls.
void OnGetEntry(
const dbus::ObjectPath& profile_path,
const std::string& entry_path,
- const ShillClientHelper::DictionaryValueCallback& callback) {
- callback.Run(DBUS_METHOD_CALL_SUCCESS, *dictionary_value_result_);
+ const ShillClientHelper::DictionaryValueCallbackWithoutStatus& callback,
+ const ShillClientHelper::ErrorCallback& error_callback) {
+ callback.Run(*dictionary_value_result_);
}
// Mock NetworkOperationCallback.
@@ -244,7 +254,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosSetNetworkServiceProperty) {
value.SetString(key2, string2);
EXPECT_CALL(*mock_service_client_,
SetProperty(dbus::ObjectPath(service_path), property,
- IsEqualTo(&value), _)).Times(1);
+ IsEqualTo(&value), _, _)).Times(1);
CrosSetNetworkServiceProperty(service_path, property, value);
}
@@ -253,7 +263,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosClearNetworkServiceProperty) {
const std::string service_path = "/";
const std::string property = "property";
EXPECT_CALL(*mock_service_client_,
- ClearProperty(dbus::ObjectPath(service_path), property, _))
+ ClearProperty(dbus::ObjectPath(service_path), property, _, _))
.Times(1);
CrosClearNetworkServiceProperty(service_path, property);
@@ -266,7 +276,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosSetNetworkDeviceProperty) {
const base::FundamentalValue value(kBool);
EXPECT_CALL(*mock_device_client_,
SetProperty(dbus::ObjectPath(device_path), StrEq(property),
- IsEqualTo(&value), _)).Times(1);
+ IsEqualTo(&value), _, _)).Times(1);
CrosSetNetworkDeviceProperty(device_path, property, value);
}
@@ -286,7 +296,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosSetNetworkManagerProperty) {
const std::string property = "property";
const base::StringValue value("string");
EXPECT_CALL(*mock_manager_client_,
- SetProperty(property, IsEqualTo(&value), _)).Times(1);
+ SetProperty(property, IsEqualTo(&value), _, _)).Times(1);
CrosSetNetworkManagerProperty(property, value);
}
@@ -295,7 +305,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosDeleteServiceFromProfile) {
const std::string profile_path("/profile/path");
const std::string service_path("/service/path");
EXPECT_CALL(*mock_profile_client_,
- DeleteEntry(dbus::ObjectPath(profile_path), service_path, _))
+ DeleteEntry(dbus::ObjectPath(profile_path), service_path, _, _))
.Times(1);
CrosDeleteServiceFromProfile(profile_path, service_path);
}
@@ -311,6 +321,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosMonitorNetworkManagerProperties) {
const std::string key = "key";
const int kValue = 42;
const base::FundamentalValue value(kValue);
+
// Start monitoring.
ShillPropertyChangedObserver* observer = NULL;
EXPECT_CALL(*mock_manager_client_, AddPropertyChangedObserver(_))
@@ -620,9 +631,11 @@ TEST_F(CrosNetworkFunctionsTest, CrosRequestNetworkProfileProperties) {
result.SetWithoutPathExpansion(key2, base::Value::CreateStringValue(value2));
// Set expectations.
dictionary_value_result_ = &result;
- EXPECT_CALL(*mock_profile_client_,
- GetProperties(dbus::ObjectPath(profile_path), _)).WillOnce(
- Invoke(this, &CrosNetworkFunctionsTest::OnGetProperties));
+ EXPECT_CALL(
+ *mock_profile_client_,
+ GetProperties(dbus::ObjectPath(profile_path), _, _)).WillOnce(
+ Invoke(this,
+ &CrosNetworkFunctionsTest::OnGetPropertiesWithoutStatus));
CrosRequestNetworkProfileProperties(
profile_path,
@@ -643,7 +656,8 @@ TEST_F(CrosNetworkFunctionsTest, CrosRequestNetworkProfileEntryProperties) {
// Set expectations.
dictionary_value_result_ = &result;
EXPECT_CALL(*mock_profile_client_,
- GetEntry(dbus::ObjectPath(profile_path), profile_entry_path, _))
+ GetEntry(dbus::ObjectPath(profile_path),
+ profile_entry_path, _, _))
.WillOnce(Invoke(this, &CrosNetworkFunctionsTest::OnGetEntry));
CrosRequestNetworkProfileEntryProperties(
@@ -680,8 +694,8 @@ TEST_F(CrosNetworkFunctionsTest, CrosRequestHiddenWifiNetworkProperties) {
base::Value::CreateStringValue(security));
// Set expectations.
const dbus::ObjectPath service_path("/service/path");
- ObjectPathDBusMethodCallback callback;
- EXPECT_CALL(*mock_manager_client_, GetService(IsEqualTo(&properties), _))
+ ObjectPathCallback callback;
+ EXPECT_CALL(*mock_manager_client_, GetService(IsEqualTo(&properties), _, _))
.WillOnce(SaveArg<1>(&callback));
EXPECT_CALL(*mock_service_client_,
GetProperties(service_path, _)).WillOnce(
@@ -693,7 +707,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosRequestHiddenWifiNetworkProperties) {
MockNetworkPropertiesCallback::CreateCallback(service_path.value(),
result));
// Run callback to invoke GetProperties.
- callback.Run(DBUS_METHOD_CALL_SUCCESS, service_path);
+ callback.Run(service_path);
}
TEST_F(CrosNetworkFunctionsTest, CrosRequestVirtualNetworkProperties) {
@@ -728,8 +742,8 @@ TEST_F(CrosNetworkFunctionsTest, CrosRequestVirtualNetworkProperties) {
// Set expectations.
const dbus::ObjectPath service_path("/service/path");
- ObjectPathDBusMethodCallback callback;
- EXPECT_CALL(*mock_manager_client_, GetService(IsEqualTo(&properties), _))
+ ObjectPathCallback callback;
+ EXPECT_CALL(*mock_manager_client_, GetService(IsEqualTo(&properties), _, _))
.WillOnce(SaveArg<1>(&callback));
EXPECT_CALL(*mock_service_client_,
GetProperties(service_path, _)).WillOnce(
@@ -741,38 +755,38 @@ TEST_F(CrosNetworkFunctionsTest, CrosRequestVirtualNetworkProperties) {
MockNetworkPropertiesCallback::CreateCallback(service_path.value(),
result));
// Run callback to invoke GetProperties.
- callback.Run(DBUS_METHOD_CALL_SUCCESS, service_path);
+ callback.Run(service_path);
}
TEST_F(CrosNetworkFunctionsTest, CrosRequestNetworkServiceDisconnect) {
const std::string service_path = "/service/path";
EXPECT_CALL(*mock_service_client_,
- Disconnect(dbus::ObjectPath(service_path), _)).Times(1);
+ Disconnect(dbus::ObjectPath(service_path), _, _)).Times(1);
CrosRequestNetworkServiceDisconnect(service_path);
}
TEST_F(CrosNetworkFunctionsTest, CrosRequestRemoveNetworkService) {
const std::string service_path = "/service/path";
EXPECT_CALL(*mock_service_client_,
- Remove(dbus::ObjectPath(service_path), _)).Times(1);
+ Remove(dbus::ObjectPath(service_path), _, _)).Times(1);
CrosRequestRemoveNetworkService(service_path);
}
TEST_F(CrosNetworkFunctionsTest, CrosRequestNetworkScan) {
EXPECT_CALL(*mock_manager_client_,
- RequestScan(flimflam::kTypeWifi, _)).Times(1);
+ RequestScan(flimflam::kTypeWifi, _, _)).Times(1);
CrosRequestNetworkScan(flimflam::kTypeWifi);
}
TEST_F(CrosNetworkFunctionsTest, CrosRequestNetworkDeviceEnable) {
const bool kEnable = true;
EXPECT_CALL(*mock_manager_client_,
- EnableTechnology(flimflam::kTypeWifi, _)).Times(1);
+ EnableTechnology(flimflam::kTypeWifi, _, _)).Times(1);
CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kEnable);
const bool kDisable = false;
EXPECT_CALL(*mock_manager_client_,
- DisableTechnology(flimflam::kTypeWifi, _)).Times(1);
+ DisableTechnology(flimflam::kTypeWifi, _, _)).Times(1);
CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kDisable);
}
@@ -883,7 +897,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosSetOfflineMode) {
const bool kOffline = true;
const base::FundamentalValue value(kOffline);
EXPECT_CALL(*mock_manager_client_, SetProperty(
- flimflam::kOfflineModeProperty, IsEqualTo(&value), _)).Times(1);
+ flimflam::kOfflineModeProperty, IsEqualTo(&value), _, _)).Times(1);
CrosSetOfflineMode(kOffline);
}
@@ -1060,7 +1074,7 @@ TEST_F(CrosNetworkFunctionsTest, CrosConfigureService) {
base::DictionaryValue value;
value.SetString(key1, string1);
value.SetString(key2, string2);
- EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _))
+ EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _, _))
.Times(1);
CrosConfigureService(value);
}
« no previous file with comments | « chrome/browser/chromeos/cros/cros_network_functions.cc ('k') | chromeos/dbus/dbus_method_call_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698