summaryrefslogtreecommitdiffstats
path: root/components/wifi/fake_wifi_service.h
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-05 19:02:37 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-05 19:02:37 +0000
commitd3758af7ccc568e0dffa8e33c6a9d950d564c97f (patch)
treeaec1ac67ddb61f14004a55b9b6adef9a8a74a769 /components/wifi/fake_wifi_service.h
parent2a898d3e8c91a83dfc998d8e06acc42d88d7995b (diff)
downloadchromium_src-d3758af7ccc568e0dffa8e33c6a9d950d564c97f.zip
chromium_src-d3758af7ccc568e0dffa8e33c6a9d950d564c97f.tar.gz
chromium_src-d3758af7ccc568e0dffa8e33c6a9d950d564c97f.tar.bz2
components: Do not include test code in wifi_component target.
wifi_component target is production code target and thus should not include code that is intended for tests. This changes makes it stop building test code in wifi_component, by extracting and exposing the FakeWiFiService interface in the header file and instantiating it directly where we used to call WiFiService::CreateForTest(). This is the second part of what was discussed in https://codereview.chromium.org/243343002 and started here https://codereview.chromium.org/259543002/ - r266025 BUG=None TEST=build and works as before, no regressions R=mef@chromium.org,thestig@chromium.org Review URL: https://codereview.chromium.org/264773017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/wifi/fake_wifi_service.h')
-rw-r--r--components/wifi/fake_wifi_service.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/components/wifi/fake_wifi_service.h b/components/wifi/fake_wifi_service.h
new file mode 100644
index 0000000..fba1f522
--- /dev/null
+++ b/components/wifi/fake_wifi_service.h
@@ -0,0 +1,77 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_WIFI_FAKE_WIFI_SERVICE_H_
+#define COMPONENTS_WIFI_FAKE_WIFI_SERVICE_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "components/wifi/wifi_service.h"
+
+namespace wifi {
+
+// Fake implementation of WiFiService used to satisfy expectations of
+// networkingPrivateApi browser test.
+class FakeWiFiService : public WiFiService {
+ public:
+ FakeWiFiService();
+ virtual ~FakeWiFiService();
+
+ virtual void Initialize(
+ scoped_refptr<base::SequencedTaskRunner> task_runner) OVERRIDE;
+ virtual void UnInitialize() OVERRIDE;
+ virtual void GetProperties(const std::string& network_guid,
+ base::DictionaryValue* properties,
+ std::string* error) OVERRIDE;
+ virtual void GetManagedProperties(const std::string& network_guid,
+ base::DictionaryValue* managed_properties,
+ std::string* error) OVERRIDE;
+ virtual void GetState(const std::string& network_guid,
+ base::DictionaryValue* properties,
+ std::string* error) OVERRIDE;
+ virtual void SetProperties(const std::string& network_guid,
+ scoped_ptr<base::DictionaryValue> properties,
+ std::string* error) OVERRIDE;
+ virtual void CreateNetwork(bool shared,
+ scoped_ptr<base::DictionaryValue> properties,
+ std::string* network_guid,
+ std::string* error) OVERRIDE;
+ virtual void GetVisibleNetworks(const std::string& network_type,
+ base::ListValue* network_list) OVERRIDE;
+ virtual void RequestNetworkScan() OVERRIDE;
+ virtual void StartConnect(const std::string& network_guid,
+ std::string* error) OVERRIDE;
+ virtual void StartDisconnect(const std::string& network_guid,
+ std::string* error) OVERRIDE;
+ virtual void GetKeyFromSystem(const std::string& network_guid,
+ std::string* key_data,
+ std::string* error) OVERRIDE;
+ virtual void SetEventObservers(
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
+ const NetworkGuidListCallback& networks_changed_observer,
+ const NetworkGuidListCallback& network_list_changed_observer) OVERRIDE;
+ virtual void RequestConnectedNetworkUpdate() OVERRIDE;
+
+ private:
+ NetworkList::iterator FindNetwork(const std::string& network_guid);
+
+ void DisconnectAllNetworksOfType(const std::string& type);
+
+ void SortNetworks();
+
+ void NotifyNetworkListChanged(const NetworkList& networks);
+
+ void NotifyNetworkChanged(const std::string& network_guid);
+
+ NetworkList networks_;
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+ NetworkGuidListCallback networks_changed_observer_;
+ NetworkGuidListCallback network_list_changed_observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeWiFiService);
+};
+
+} // namespace wifi
+
+#endif // COMPONENTS_WIFI_FAKE_WIFI_SERVICE_H_