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

Unified Diff: chromeos/dbus/shill_manager_client_unittest.cc

Issue 11887008: Deprecate ShillNetworkClient and add GeolocationHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittest Created 7 years, 11 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/dbus/shill_manager_client_unittest.cc
diff --git a/chromeos/dbus/shill_manager_client_unittest.cc b/chromeos/dbus/shill_manager_client_unittest.cc
index 73e456709fc97ca99b2a847cc3c271c2e9fd973f..a4a241e9a2f28ca3f70a2990e9468dbfb4b3c4ad 100644
--- a/chromeos/dbus/shill_manager_client_unittest.cc
+++ b/chromeos/dbus/shill_manager_client_unittest.cc
@@ -210,6 +210,56 @@ TEST_F(ShillManagerClientTest, CallGetPropertiesAndBlock) {
EXPECT_TRUE(value.Equals(result.get()));
}
+TEST_F(ShillManagerClientTest, GetNetworksForGeolocation) {
+ // Create response.
+ scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
+
+ dbus::MessageWriter writer(response.get());
+ dbus::MessageWriter type_dict_writer(NULL);
+ writer.OpenArray("{sv}", &type_dict_writer);
+ dbus::MessageWriter type_entry_writer(NULL);
+ type_dict_writer.OpenDictEntry(&type_entry_writer);
+ type_entry_writer.AppendString(flimflam::kTypeWifi);
+ dbus::MessageWriter variant_writer(NULL);
+ type_entry_writer.OpenVariant("aa{ss}", &variant_writer);
+ dbus::MessageWriter wap_list_writer(NULL);
+ variant_writer.OpenArray("a{ss}", &wap_list_writer);
+ dbus::MessageWriter property_dict_writer(NULL);
+ wap_list_writer.OpenArray("{ss}", &property_dict_writer);
+ dbus::MessageWriter property_entry_writer(NULL);
+ property_dict_writer.OpenDictEntry(&property_entry_writer);
+ property_entry_writer.AppendString(shill::kGeoMacAddressProperty);
+ property_entry_writer.AppendString("01:23:45:67:89:AB");
+ property_dict_writer.CloseContainer(&property_entry_writer);
+ wap_list_writer.CloseContainer(&property_dict_writer);
+ variant_writer.CloseContainer(&wap_list_writer);
+ type_entry_writer.CloseContainer(&wap_list_writer);
+ type_dict_writer.CloseContainer(&type_entry_writer);
+ writer.CloseContainer(&type_dict_writer);
+
+
+ // Create the expected value.
+ base::DictionaryValue type_dict_value;
+ base::ListValue* type_entry_value = new base::ListValue;
+ base::DictionaryValue* property_dict_value = new base::DictionaryValue;
+ property_dict_value->SetWithoutPathExpansion(
+ shill::kGeoMacAddressProperty,
+ base::Value::CreateStringValue("01:23:45:67:89:AB"));
+ type_entry_value->Append(property_dict_value);
+ type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value);
+
+ // Set expectations.
+ PrepareForMethodCall(shill::kGetNetworksForGeolocation,
+ base::Bind(&ExpectNoArgument),
+ response.get());
+ // Call method.
+ client_->GetNetworksForGeolocation(base::Bind(&ExpectDictionaryValueResult,
+ &type_dict_value));
+
+ // Run the message loop.
+ message_loop_.RunUntilIdle();
+}
+
TEST_F(ShillManagerClientTest, SetProperty) {
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());

Powered by Google App Engine
This is Rietveld 408576698