Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chromeos/dbus/fake_shill_manager_client.h

Issue 31773002: cryptohome: Convet all *Stub classes into Fake* classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/dbus/fake_shill_manager_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_
7 7
8 #include "base/values.h" 8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "chromeos/chromeos_export.h"
9 #include "chromeos/dbus/shill_manager_client.h" 13 #include "chromeos/dbus/shill_manager_client.h"
10 #include "chromeos/dbus/shill_property_changed_observer.h"
11 14
12 namespace chromeos { 15 namespace chromeos {
13 16
14 // A fake implementation of ShillManagerClient. This class does nothing. 17 // A fake implementation of ShillManagerClient. This works in close coordination
15 class FakeShillManagerClient : public ShillManagerClient { 18 // with FakeShillServiceClient. FakeShillDeviceClient, and
19 // FakeShillProfileClient, and is not intended to be used independently.
20 class CHROMEOS_EXPORT FakeShillManagerClient :
21 public ShillManagerClient,
22 public ShillManagerClient::TestInterface {
16 public: 23 public:
17 FakeShillManagerClient(); 24 FakeShillManagerClient();
18 virtual ~FakeShillManagerClient(); 25 virtual ~FakeShillManagerClient();
19 26
20 // ShillManagerClient overrides 27 // ShillManagerClient overrides
21 virtual void Init(dbus::Bus* bus) OVERRIDE; 28 virtual void Init(dbus::Bus* bus) OVERRIDE;
22 virtual void AddPropertyChangedObserver( 29 virtual void AddPropertyChangedObserver(
23 ShillPropertyChangedObserver* observer) OVERRIDE; 30 ShillPropertyChangedObserver* observer) OVERRIDE;
24 virtual void RemovePropertyChangedObserver( 31 virtual void RemovePropertyChangedObserver(
25 ShillPropertyChangedObserver* observer) OVERRIDE; 32 ShillPropertyChangedObserver* observer) OVERRIDE;
26 virtual void GetProperties(const DictionaryValueCallback& callback) OVERRIDE; 33 virtual void GetProperties(const DictionaryValueCallback& callback) OVERRIDE;
27 virtual void GetNetworksForGeolocation( 34 virtual void GetNetworksForGeolocation(
28 const DictionaryValueCallback& callback) OVERRIDE; 35 const DictionaryValueCallback& callback) OVERRIDE;
29 virtual void SetProperty(const std::string& name, 36 virtual void SetProperty(const std::string& name,
30 const base::Value& value, 37 const base::Value& value,
31 const base::Closure& callback, 38 const base::Closure& callback,
32 const ErrorCallback& error_callback) OVERRIDE; 39 const ErrorCallback& error_callback) OVERRIDE;
33 virtual void RequestScan(const std::string& type, 40 virtual void RequestScan(const std::string& type,
34 const base::Closure& callback, 41 const base::Closure& callback,
35 const ErrorCallback& error_callback) OVERRIDE; 42 const ErrorCallback& error_callback) OVERRIDE;
36 virtual void EnableTechnology(const std::string& type, 43 virtual void EnableTechnology(
37 const base::Closure& callback, 44 const std::string& type,
38 const ErrorCallback& error_callback) OVERRIDE; 45 const base::Closure& callback,
39 virtual void DisableTechnology(const std::string& type, 46 const ErrorCallback& error_callback) OVERRIDE;
40 const base::Closure& callback, 47 virtual void DisableTechnology(
41 const ErrorCallback& error_callback) OVERRIDE; 48 const std::string& type,
42 virtual void ConfigureService(const base::DictionaryValue& properties, 49 const base::Closure& callback,
43 const ObjectPathCallback& callback, 50 const ErrorCallback& error_callback) OVERRIDE;
44 const ErrorCallback& error_callback) OVERRIDE; 51 virtual void ConfigureService(
52 const base::DictionaryValue& properties,
53 const ObjectPathCallback& callback,
54 const ErrorCallback& error_callback) OVERRIDE;
45 virtual void ConfigureServiceForProfile( 55 virtual void ConfigureServiceForProfile(
46 const dbus::ObjectPath& profile_path, 56 const dbus::ObjectPath& profile_path,
47 const base::DictionaryValue& properties, 57 const base::DictionaryValue& properties,
48 const ObjectPathCallback& callback, 58 const ObjectPathCallback& callback,
49 const ErrorCallback& error_callback) OVERRIDE; 59 const ErrorCallback& error_callback) OVERRIDE;
50 virtual void GetService(const base::DictionaryValue& properties, 60 virtual void GetService(
51 const ObjectPathCallback& callback, 61 const base::DictionaryValue& properties,
52 const ErrorCallback& error_callback) OVERRIDE; 62 const ObjectPathCallback& callback,
63 const ErrorCallback& error_callback) OVERRIDE;
53 virtual void VerifyDestination(const VerificationProperties& properties, 64 virtual void VerifyDestination(const VerificationProperties& properties,
54 const BooleanCallback& callback, 65 const BooleanCallback& callback,
55 const ErrorCallback& error_callback) OVERRIDE; 66 const ErrorCallback& error_callback) OVERRIDE;
56 virtual void VerifyAndEncryptCredentials( 67 virtual void VerifyAndEncryptCredentials(
57 const VerificationProperties& properties, 68 const VerificationProperties& properties,
58 const std::string& service_path, 69 const std::string& service_path,
59 const StringCallback& callback, 70 const StringCallback& callback,
60 const ErrorCallback& error_callback) OVERRIDE; 71 const ErrorCallback& error_callback) OVERRIDE;
61 virtual void VerifyAndEncryptData( 72 virtual void VerifyAndEncryptData(
62 const VerificationProperties& properties, 73 const VerificationProperties& properties,
63 const std::string& data, 74 const std::string& data,
64 const StringCallback& callback, 75 const StringCallback& callback,
65 const ErrorCallback& error_callback) OVERRIDE; 76 const ErrorCallback& error_callback) OVERRIDE;
66 virtual void ConnectToBestServices( 77 virtual void ConnectToBestServices(
67 const base::Closure& callback, 78 const base::Closure& callback,
68 const ErrorCallback& error_callback) OVERRIDE; 79 const ErrorCallback& error_callback) OVERRIDE;
69 virtual TestInterface* GetTestInterface() OVERRIDE; 80 virtual ShillManagerClient::TestInterface* GetTestInterface() OVERRIDE;
81
82 // ShillManagerClient::TestInterface overrides.
83 virtual void AddDevice(const std::string& device_path) OVERRIDE;
84 virtual void RemoveDevice(const std::string& device_path) OVERRIDE;
85 virtual void ClearDevices() OVERRIDE;
86 virtual void AddTechnology(const std::string& type, bool enabled) OVERRIDE;
87 virtual void RemoveTechnology(const std::string& type) OVERRIDE;
88 virtual void SetTechnologyInitializing(const std::string& type,
89 bool initializing) OVERRIDE;
90 virtual void AddGeoNetwork(const std::string& technology,
91 const base::DictionaryValue& network) OVERRIDE;
92 virtual void AddProfile(const std::string& profile_path) OVERRIDE;
93 virtual void ClearProperties() OVERRIDE;
94 virtual void AddManagerService(const std::string& service_path,
95 bool add_to_visible_list,
96 bool add_to_watch_list) OVERRIDE;
97 virtual void RemoveManagerService(const std::string& service_path) OVERRIDE;
98 virtual void ClearManagerServices() OVERRIDE;
99 virtual void SortManagerServices() OVERRIDE;
70 100
71 private: 101 private:
102 void AddServiceToWatchList(const std::string& service_path);
103 void SetDefaultProperties();
104 void PassStubProperties(const DictionaryValueCallback& callback) const;
105 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const;
106 void CallNotifyObserversPropertyChanged(const std::string& property,
107 int delay_ms);
108 void NotifyObserversPropertyChanged(const std::string& property);
109 base::ListValue* GetListProperty(const std::string& property);
110 bool TechnologyEnabled(const std::string& type) const;
111 void SetTechnologyEnabled(const std::string& type,
112 const base::Closure& callback,
113 bool enabled);
114 base::ListValue* GetEnabledServiceList(const std::string& property) const;
115 void ScanCompleted(const std::string& device_path,
116 const base::Closure& callback);
117
118 // Dictionary of property name -> property value
119 base::DictionaryValue stub_properties_;
120 // Dictionary of technology -> list of property dictionaries
121 base::DictionaryValue stub_geo_networks_;
122
123 ObserverList<ShillPropertyChangedObserver> observer_list_;
124
125 // Note: This should remain the last member so it'll be destroyed and
126 // invalidate its weak pointers before any other members are destroyed.
127 base::WeakPtrFactory<FakeShillManagerClient> weak_ptr_factory_;
128
72 DISALLOW_COPY_AND_ASSIGN(FakeShillManagerClient); 129 DISALLOW_COPY_AND_ASSIGN(FakeShillManagerClient);
73 }; 130 };
74 131
75 } // namespace chromeos 132 } // namespace chromeos
76 133
77 #endif // CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_ 134 #endif // CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/dbus/fake_shill_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698