Allow only one bookmark to be added for multiple fast starring
[chromium-blink-merge.git] / components / wifi / fake_wifi_service.h
blobbb5c757479571981eb200b574be00ec2043b8dbb
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WIFI_FAKE_WIFI_SERVICE_H_
6 #define COMPONENTS_WIFI_FAKE_WIFI_SERVICE_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "components/wifi/network_properties.h"
13 #include "components/wifi/wifi_service.h"
15 namespace wifi {
17 // Fake implementation of WiFiService used to satisfy expectations of
18 // networkingPrivateApi browser test.
19 class FakeWiFiService : public WiFiService {
20 public:
21 FakeWiFiService();
22 ~FakeWiFiService() override;
24 void Initialize(
25 scoped_refptr<base::SequencedTaskRunner> task_runner) override;
26 void UnInitialize() override;
27 void GetProperties(const std::string& network_guid,
28 base::DictionaryValue* properties,
29 std::string* error) override;
30 void GetManagedProperties(const std::string& network_guid,
31 base::DictionaryValue* managed_properties,
32 std::string* error) override;
33 void GetState(const std::string& network_guid,
34 base::DictionaryValue* properties,
35 std::string* error) override;
36 void SetProperties(const std::string& network_guid,
37 scoped_ptr<base::DictionaryValue> properties,
38 std::string* error) override;
39 void CreateNetwork(bool shared,
40 scoped_ptr<base::DictionaryValue> properties,
41 std::string* network_guid,
42 std::string* error) override;
43 void GetVisibleNetworks(const std::string& network_type,
44 base::ListValue* network_list,
45 bool include_details) override;
46 void RequestNetworkScan() override;
47 void StartConnect(const std::string& network_guid,
48 std::string* error) override;
49 void StartDisconnect(const std::string& network_guid,
50 std::string* error) override;
51 void GetKeyFromSystem(const std::string& network_guid,
52 std::string* key_data,
53 std::string* error) override;
54 void SetEventObservers(
55 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
56 const NetworkGuidListCallback& networks_changed_observer,
57 const NetworkGuidListCallback& network_list_changed_observer) override;
58 void RequestConnectedNetworkUpdate() override;
59 void GetConnectedNetworkSSID(std::string* ssid,
60 std::string* error) override;
62 private:
63 NetworkList::iterator FindNetwork(const std::string& network_guid);
65 void DisconnectAllNetworksOfType(const std::string& type);
67 void SortNetworks();
69 void NotifyNetworkListChanged(const NetworkList& networks);
71 void NotifyNetworkChanged(const std::string& network_guid);
73 NetworkList networks_;
74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
75 NetworkGuidListCallback networks_changed_observer_;
76 NetworkGuidListCallback network_list_changed_observer_;
78 DISALLOW_COPY_AND_ASSIGN(FakeWiFiService);
81 } // namespace wifi
83 #endif // COMPONENTS_WIFI_FAKE_WIFI_SERVICE_H_