shill: wifi: Implement FindService
Implement FindService so that WiFi::GetService can return an
already exisiting service if one exists. We consider services
that we haven't found in WiFi::GetService to be hidden unless
the caller specifies otherwise.
BUG=chromium-os:22074
TEST=New Unit Test
Change-Id: If5a41509c0f58c5bdb4a01d550922bb778d0d259
Reviewed-on: https://gerrit.chromium.org/gerrit/11458
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
diff --git a/wifi.h b/wifi.h
index b92fd69..6965560 100644
--- a/wifi.h
+++ b/wifi.h
@@ -10,6 +10,7 @@
#include <vector>
#include <dbus-c++/dbus.h>
+#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "shill/device.h"
#include "shill/event_dispatcher.h"
@@ -56,6 +57,9 @@
virtual WiFiServiceRefPtr GetService(const KeyValueStore &args, Error *error);
private:
+ FRIEND_TEST(WiFiMainTest, FindServiceWEP);
+ FRIEND_TEST(WiFiMainTest, FindServiceWPA);
+
typedef std::map<const std::string, WiFiEndpointRefPtr> EndpointMap;
typedef std::map<const std::string, WiFiServiceRefPtr> ServiceMap;
@@ -68,6 +72,9 @@
static const char kManagerErrorUnsupportedServiceType[];
static const char kManagerErrorUnsupportedServiceMode[];
+ WiFiServiceRefPtr FindService(const std::vector<uint8_t> &ssid,
+ const std::string &mode,
+ const std::string &security) const;
ByteArrays GetHiddenSSIDList();
void ScanDoneTask();
void ScanTask();