summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/shill_manager_client_unittest.cc
diff options
context:
space:
mode:
authordubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 10:00:39 +0000
committerdubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 10:00:39 +0000
commitb7c377e5e5e0daf67378e96368c7b8bf63b1883d (patch)
tree023544da3eaeb51cebc1e2a88bc121f563d7b11d /chromeos/dbus/shill_manager_client_unittest.cc
parent8fe381e9c7ebec0b30ba72791fbe43362003459a (diff)
downloadchromium_src-b7c377e5e5e0daf67378e96368c7b8bf63b1883d.zip
chromium_src-b7c377e5e5e0daf67378e96368c7b8bf63b1883d.tar.gz
chromium_src-b7c377e5e5e0daf67378e96368c7b8bf63b1883d.tar.bz2
Reland 176858 - Deprecate ShillNetworkClient and add GeolocationHandler
> Deprecate ShillNetworkClient and add GeolocationHandler > > Shill deprecated Manager.Network which was being used to get wifi access point data. > This eliminates the dead code and adds GeolocationHandler which currently queries Shill.Manager for geolocation data, and caches and returns the result. > > BUG=167987 > For chrome/browser/geolocation: > TBR=joth@chromium.org > > Review URL: https://chromiumcodereview.appspot.com/11887008 TBR=stevenjb@chromium.org BUG=None Review URL: https://codereview.chromium.org/11880043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/shill_manager_client_unittest.cc')
-rw-r--r--chromeos/dbus/shill_manager_client_unittest.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/chromeos/dbus/shill_manager_client_unittest.cc b/chromeos/dbus/shill_manager_client_unittest.cc
index 73e4567..a4a241e 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());