summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/shill_manager_client_unittest.cc
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 08:51:17 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 08:51:17 +0000
commit2632f5046d811f8780484cbaf983f3c9a97c9ea9 (patch)
treeaee09fbc24f1bb9524de64726638ddd3c8f826f3 /chromeos/dbus/shill_manager_client_unittest.cc
parentd2397d877f3cd67b0010abecb451ae390cf789b6 (diff)
downloadchromium_src-2632f5046d811f8780484cbaf983f3c9a97c9ea9.zip
chromium_src-2632f5046d811f8780484cbaf983f3c9a97c9ea9.tar.gz
chromium_src-2632f5046d811f8780484cbaf983f3c9a97c9ea9.tar.bz2
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176858 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());