Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_SHILL_PROFILE_CLIENT_STUB_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ |
| 6 #define CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ | 6 #define CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chromeos/dbus/shill_manager_client.h" | |
| 11 #include "chromeos/dbus/shill_profile_client.h" | 13 #include "chromeos/dbus/shill_profile_client.h" |
| 12 | 14 |
| 13 namespace chromeos { | 15 namespace chromeos { |
| 14 | 16 |
| 15 // A stub implementation of ShillProfileClient. | 17 // A stub implementation of ShillProfileClient. |
| 16 class ShillProfileClientStub : public ShillProfileClient, | 18 class ShillProfileClientStub : public ShillProfileClient, |
| 17 public ShillProfileClient::TestInterface { | 19 public ShillProfileClient::TestInterface { |
| 18 public: | 20 public: |
| 19 ShillProfileClientStub(); | 21 explicit ShillProfileClientStub( |
| 22 ShillManagerClient::TestInterface* manager_test); | |
|
stevenjb
2013/04/26 21:00:49
I don't know that I like this. Is there ever a sit
pneubeck (no reviews)
2013/04/29 18:05:51
My thoughts were:
1.
managed_network_configuration
stevenjb
2013/04/30 17:42:47
I believe strongly that we *shouldn't* combine moc
pneubeck (no reviews)
2013/05/03 17:32:55
I have to use the ClientMocks in the unit test to
| |
| 20 virtual ~ShillProfileClientStub(); | 23 virtual ~ShillProfileClientStub(); |
| 21 | 24 |
| 22 // ShillProfileClient overrides. | 25 // ShillProfileClient overrides. |
| 23 virtual void AddPropertyChangedObserver( | 26 virtual void AddPropertyChangedObserver( |
| 24 const dbus::ObjectPath& profile_path, | 27 const dbus::ObjectPath& profile_path, |
| 25 ShillPropertyChangedObserver* observer) OVERRIDE; | 28 ShillPropertyChangedObserver* observer) OVERRIDE; |
| 26 virtual void RemovePropertyChangedObserver( | 29 virtual void RemovePropertyChangedObserver( |
| 27 const dbus::ObjectPath& profile_path, | 30 const dbus::ObjectPath& profile_path, |
| 28 ShillPropertyChangedObserver* observer) OVERRIDE; | 31 ShillPropertyChangedObserver* observer) OVERRIDE; |
| 29 virtual void GetProperties( | 32 virtual void GetProperties( |
| 30 const dbus::ObjectPath& profile_path, | 33 const dbus::ObjectPath& profile_path, |
| 31 const DictionaryValueCallbackWithoutStatus& callback, | 34 const DictionaryValueCallbackWithoutStatus& callback, |
| 32 const ErrorCallback& error_callback) OVERRIDE; | 35 const ErrorCallback& error_callback) OVERRIDE; |
| 33 virtual void GetEntry(const dbus::ObjectPath& profile_path, | 36 virtual void GetEntry(const dbus::ObjectPath& profile_path, |
| 34 const std::string& entry_path, | 37 const std::string& entry_path, |
| 35 const DictionaryValueCallbackWithoutStatus& callback, | 38 const DictionaryValueCallbackWithoutStatus& callback, |
| 36 const ErrorCallback& error_callback) OVERRIDE; | 39 const ErrorCallback& error_callback) OVERRIDE; |
| 37 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, | 40 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, |
| 38 const std::string& entry_path, | 41 const std::string& entry_path, |
| 39 const base::Closure& callback, | 42 const base::Closure& callback, |
| 40 const ErrorCallback& error_callback) OVERRIDE; | 43 const ErrorCallback& error_callback) OVERRIDE; |
| 41 virtual ShillProfileClient::TestInterface* GetTestInterface() OVERRIDE; | 44 virtual ShillProfileClient::TestInterface* GetTestInterface() OVERRIDE; |
| 42 | 45 |
| 43 // ShillProfileClient::TestInterface overrides. | 46 // ShillProfileClient::TestInterface overrides. |
| 44 virtual void AddProfile(const std::string& profile_path) OVERRIDE; | 47 virtual void AddProfile(const std::string& profile_path, |
| 48 const std::string& userhash) OVERRIDE; | |
| 45 virtual void AddEntry(const std::string& profile_path, | 49 virtual void AddEntry(const std::string& profile_path, |
| 46 const std::string& entry_path, | 50 const std::string& entry_path, |
| 47 const base::DictionaryValue& properties) OVERRIDE; | 51 const base::DictionaryValue& properties) OVERRIDE; |
| 48 virtual bool AddService(const std::string& service_path) OVERRIDE; | 52 virtual bool AddService(const std::string& service_path) OVERRIDE; |
| 49 | 53 |
| 50 private: | 54 private: |
| 51 base::DictionaryValue* GetProfile(const dbus::ObjectPath& profile_path, | 55 struct ProfileProperties; |
| 52 const ErrorCallback& error_callback); | 56 typedef std::map<std::string, ProfileProperties*> ProfileMap; |
| 53 | 57 |
| 54 // This maps profile path -> entry path -> Shill properties. | 58 ProfileProperties* GetProfile(const dbus::ObjectPath& profile_path, |
| 55 base::DictionaryValue profile_entries_; | 59 const ErrorCallback& error_callback); |
| 60 | |
| 61 // The values are owned by this class and are explicitly destroyed where | |
| 62 // necessary. | |
| 63 ProfileMap profiles_; | |
| 64 | |
| 65 ShillManagerClient::TestInterface* manager_test_; | |
| 56 | 66 |
| 57 DISALLOW_COPY_AND_ASSIGN(ShillProfileClientStub); | 67 DISALLOW_COPY_AND_ASSIGN(ShillProfileClientStub); |
| 58 }; | 68 }; |
| 59 | 69 |
| 60 } // namespace chromeos | 70 } // namespace chromeos |
| 61 | 71 |
| 62 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ | 72 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ |
| OLD | NEW |