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

Unified Diff: chromeos/dbus/flimflam_device_client_unittest.cc

Issue 10078007: Add chromeos::FlimflamDeviceClient::CallGetPropertiesAndBlock/CallAddIPConfigAndBlock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add TODO Created 8 years, 8 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 | « chromeos/dbus/flimflam_device_client.cc ('k') | chromeos/dbus/mock_flimflam_device_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/flimflam_device_client_unittest.cc
diff --git a/chromeos/dbus/flimflam_device_client_unittest.cc b/chromeos/dbus/flimflam_device_client_unittest.cc
index 516ceb48aa166d9161ba11bea189cc9c0cb5397e..201abb3b4c710144d41eb8f5bd4f023fb0be8855 100644
--- a/chromeos/dbus/flimflam_device_client_unittest.cc
+++ b/chromeos/dbus/flimflam_device_client_unittest.cc
@@ -121,6 +121,34 @@ TEST_F(FlimflamDeviceClientTest, GetProperties) {
message_loop_.RunAllPending();
}
+TEST_F(FlimflamDeviceClientTest, CallGetPropertiesAndBlock) {
+ const bool kValue = true;
+ // Create response.
+ scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
+ dbus::MessageWriter writer(response.get());
+ dbus::MessageWriter array_writer(NULL);
+ writer.OpenArray("{sv}", &array_writer);
+ dbus::MessageWriter entry_writer(NULL);
+ array_writer.OpenDictEntry(&entry_writer);
+ entry_writer.AppendString(flimflam::kCellularAllowRoamingProperty);
+ entry_writer.AppendVariantOfBool(kValue);
+ array_writer.CloseContainer(&entry_writer);
+ writer.CloseContainer(&array_writer);
+
+ // Set expectations.
+ base::DictionaryValue value;
+ value.SetWithoutPathExpansion(flimflam::kCellularAllowRoamingProperty,
+ base::Value::CreateBooleanValue(kValue));
+ PrepareForMethodCall(flimflam::kGetPropertiesFunction,
+ base::Bind(&ExpectNoArgument),
+ response.get());
+ // Call method.
+ scoped_ptr<base::DictionaryValue> result(
+ client_->CallGetPropertiesAndBlock(dbus::ObjectPath(kExampleDevicePath)));
+ ASSERT_TRUE(result.get());
+ EXPECT_TRUE(result->Equals(&value));
+}
+
TEST_F(FlimflamDeviceClientTest, ProposeScan) {
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
@@ -174,6 +202,42 @@ TEST_F(FlimflamDeviceClientTest, ClearProperty) {
message_loop_.RunAllPending();
}
+TEST_F(FlimflamDeviceClientTest, AddIPConfig) {
+ const dbus::ObjectPath expected_result("/result/path");
+ // Create response.
+ scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
+ dbus::MessageWriter writer(response.get());
+ writer.AppendObjectPath(expected_result);
+
+ // Set expectations.
+ PrepareForMethodCall(flimflam::kAddIPConfigFunction,
+ base::Bind(&ExpectStringArgument, flimflam::kTypeDHCP),
+ response.get());
+ // Call method.
+ client_->AddIPConfig(dbus::ObjectPath(kExampleDevicePath),
+ flimflam::kTypeDHCP,
+ base::Bind(&ExpectObjectPathResult, expected_result));
+ // Run the message loop.
+ message_loop_.RunAllPending();
+}
+
+TEST_F(FlimflamDeviceClientTest, CallAddIPConfigAndBlock) {
+ const dbus::ObjectPath expected_result("/result/path");
+ // Create response.
+ scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
+ dbus::MessageWriter writer(response.get());
+ writer.AppendObjectPath(expected_result);
+
+ // Set expectations.
+ PrepareForMethodCall(flimflam::kAddIPConfigFunction,
+ base::Bind(&ExpectStringArgument, flimflam::kTypeDHCP),
+ response.get());
+ // Call method.
+ const dbus::ObjectPath result = client_->CallAddIPConfigAndBlock(
+ dbus::ObjectPath(kExampleDevicePath), flimflam::kTypeDHCP);
+ EXPECT_EQ(expected_result, result);
+}
+
TEST_F(FlimflamDeviceClientTest, RequirePin) {
const char kPin[] = "123456";
const bool kRequired = true;
« no previous file with comments | « chromeos/dbus/flimflam_device_client.cc ('k') | chromeos/dbus/mock_flimflam_device_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698