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

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

Issue 181413006: Replace misc. network stub flags with more flexible ones (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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
« no previous file with comments | « chromeos/dbus/fake_dbus_thread_manager.cc ('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 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 virtual void SetManagerProperty(const std::string& key, 94 virtual void SetManagerProperty(const std::string& key,
95 const base::Value& value) OVERRIDE; 95 const base::Value& value) OVERRIDE;
96 virtual void AddManagerService(const std::string& service_path, 96 virtual void AddManagerService(const std::string& service_path,
97 bool add_to_visible_list, 97 bool add_to_visible_list,
98 bool add_to_watch_list) OVERRIDE; 98 bool add_to_watch_list) OVERRIDE;
99 virtual void RemoveManagerService(const std::string& service_path) OVERRIDE; 99 virtual void RemoveManagerService(const std::string& service_path) OVERRIDE;
100 virtual void ClearManagerServices() OVERRIDE; 100 virtual void ClearManagerServices() OVERRIDE;
101 virtual void ServiceStateChanged(const std::string& service_path, 101 virtual void ServiceStateChanged(const std::string& service_path,
102 const std::string& state) OVERRIDE; 102 const std::string& state) OVERRIDE;
103 virtual void SortManagerServices() OVERRIDE; 103 virtual void SortManagerServices() OVERRIDE;
104 virtual void SetupDefaultEnvironment() OVERRIDE;
105 virtual int GetInteractiveDelay() const OVERRIDE;
104 106
105 private: 107 private:
106 void AddServiceToWatchList(const std::string& service_path); 108 void AddServiceToWatchList(const std::string& service_path);
107 void SetDefaultProperties(); 109 void SetDefaultProperties();
108 void PassStubProperties(const DictionaryValueCallback& callback) const; 110 void PassStubProperties(const DictionaryValueCallback& callback) const;
109 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const; 111 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const;
110 void CallNotifyObserversPropertyChanged(const std::string& property); 112 void CallNotifyObserversPropertyChanged(const std::string& property);
111 void NotifyObserversPropertyChanged(const std::string& property); 113 void NotifyObserversPropertyChanged(const std::string& property);
112 base::ListValue* GetListProperty(const std::string& property); 114 base::ListValue* GetListProperty(const std::string& property);
113 bool TechnologyEnabled(const std::string& type) const; 115 bool TechnologyEnabled(const std::string& type) const;
114 void SetTechnologyEnabled(const std::string& type, 116 void SetTechnologyEnabled(const std::string& type,
115 const base::Closure& callback, 117 const base::Closure& callback,
116 bool enabled); 118 bool enabled);
117 base::ListValue* GetEnabledServiceList(const std::string& property) const; 119 base::ListValue* GetEnabledServiceList(const std::string& property) const;
118 void ScanCompleted(const std::string& device_path, 120 void ScanCompleted(const std::string& device_path,
119 const base::Closure& callback); 121 const base::Closure& callback);
120 122
123 // Parses the command line for Shill stub switches and sets initial states.
124 // Uses comma-separated name-value pairs (see SplitStringIntoKeyValuePairs):
125 // interactive={delay} - sets delay in seconds for interactive UI
126 // {wifi,cellular,etc}={on,off,disabled,none} - sets initial state for type
127 void ParseCommandLineSwitch();
128 bool ParseOption(const std::string& arg0, const std::string& arg1);
129 bool SetInitialNetworkState(std::string type_arg, std::string state_arg);
130 std::string GetInitialStateForType(const std::string& type,
131 bool* enabled);
132
121 // Dictionary of property name -> property value 133 // Dictionary of property name -> property value
122 base::DictionaryValue stub_properties_; 134 base::DictionaryValue stub_properties_;
135
123 // Dictionary of technology -> list of property dictionaries 136 // Dictionary of technology -> list of property dictionaries
124 base::DictionaryValue stub_geo_networks_; 137 base::DictionaryValue stub_geo_networks_;
125 138
139 // Seconds to delay interactive actions
140 int interactive_delay_;
141
142 // Initial state for fake services.
143 std::map<std::string, std::string> shill_initial_state_map_;
144
126 ObserverList<ShillPropertyChangedObserver> observer_list_; 145 ObserverList<ShillPropertyChangedObserver> observer_list_;
127 146
128 // Note: This should remain the last member so it'll be destroyed and 147 // Note: This should remain the last member so it'll be destroyed and
129 // invalidate its weak pointers before any other members are destroyed. 148 // invalidate its weak pointers before any other members are destroyed.
130 base::WeakPtrFactory<FakeShillManagerClient> weak_ptr_factory_; 149 base::WeakPtrFactory<FakeShillManagerClient> weak_ptr_factory_;
131 150
132 // Track the default service for signaling Manager.DefaultService. 151 // Track the default service for signaling Manager.DefaultService.
133 std::string default_service_; 152 std::string default_service_;
134 153
135 DISALLOW_COPY_AND_ASSIGN(FakeShillManagerClient); 154 DISALLOW_COPY_AND_ASSIGN(FakeShillManagerClient);
136 }; 155 };
137 156
138 } // namespace chromeos 157 } // namespace chromeos
139 158
140 #endif // CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_ 159 #endif // CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_dbus_thread_manager.cc ('k') | chromeos/dbus/fake_shill_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698