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

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

Issue 12381002: Improve network stub behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
OLDNEW
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_SERVICE_CLIENT_STUB_H_ 5 #ifndef CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_STUB_H_
6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_STUB_H_ 6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_STUB_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const ErrorCallback& error_callback) OVERRIDE; 64 const ErrorCallback& error_callback) OVERRIDE;
65 virtual bool CallActivateCellularModemAndBlock( 65 virtual bool CallActivateCellularModemAndBlock(
66 const dbus::ObjectPath& service_path, 66 const dbus::ObjectPath& service_path,
67 const std::string& carrier) OVERRIDE; 67 const std::string& carrier) OVERRIDE;
68 virtual ShillServiceClient::TestInterface* GetTestInterface() OVERRIDE; 68 virtual ShillServiceClient::TestInterface* GetTestInterface() OVERRIDE;
69 69
70 // ShillServiceClient::TestInterface overrides. 70 // ShillServiceClient::TestInterface overrides.
71 virtual void AddService(const std::string& service_path, 71 virtual void AddService(const std::string& service_path,
72 const std::string& name, 72 const std::string& name,
73 const std::string& type, 73 const std::string& type,
74 const std::string& state) OVERRIDE; 74 const std::string& state,
75 bool add_to_watch_list) OVERRIDE;
75 virtual void RemoveService(const std::string& service_path) OVERRIDE; 76 virtual void RemoveService(const std::string& service_path) OVERRIDE;
76 virtual void SetServiceProperty(const std::string& service_path, 77 virtual void SetServiceProperty(const std::string& service_path,
77 const std::string& property, 78 const std::string& property,
78 const base::Value& value) OVERRIDE; 79 const base::Value& value) OVERRIDE;
80 virtual const base::DictionaryValue* GetServiceProperties(
81 const std::string& service_path) const OVERRIDE;
79 virtual void ClearServices() OVERRIDE; 82 virtual void ClearServices() OVERRIDE;
80 83
81 private: 84 private:
82 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList; 85 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList;
83 86
84 void SetDefaultProperties(); 87 void SetDefaultProperties();
85 void PassStubServiceProperties(const dbus::ObjectPath& service_path, 88 void PassStubServiceProperties(const dbus::ObjectPath& service_path,
86 const DictionaryValueCallback& callback); 89 const DictionaryValueCallback& callback);
87 void NotifyObserversPropertyChanged(const dbus::ObjectPath& service_path, 90 void NotifyObserversPropertyChanged(const dbus::ObjectPath& service_path,
88 const std::string& property); 91 const std::string& property);
89 base::DictionaryValue* GetServiceProperties(const std::string& service_path); 92 base::DictionaryValue* GetModifiableServiceProperties(
93 const std::string& service_path);
90 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path); 94 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path);
91 95
92 base::DictionaryValue stub_services_; 96 base::DictionaryValue stub_services_;
93 // Observer list for each service. 97 // Observer list for each service.
94 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_; 98 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_;
95 99
96 // Note: This should remain the last member so it'll be destroyed and 100 // Note: This should remain the last member so it'll be destroyed and
97 // invalidate its weak pointers before any other members are destroyed. 101 // invalidate its weak pointers before any other members are destroyed.
98 base::WeakPtrFactory<ShillServiceClientStub> weak_ptr_factory_; 102 base::WeakPtrFactory<ShillServiceClientStub> weak_ptr_factory_;
99 103
100 DISALLOW_COPY_AND_ASSIGN(ShillServiceClientStub); 104 DISALLOW_COPY_AND_ASSIGN(ShillServiceClientStub);
101 }; 105 };
102 106
103 } // namespace chromeos 107 } // namespace chromeos
104 108
105 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_STUB_H_ 109 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_STUB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698