Index: chromeos/dbus/fake_shill_manager_client.h |
diff --git a/chromeos/dbus/fake_shill_manager_client.h b/chromeos/dbus/fake_shill_manager_client.h |
index 1d1ba1aefe6e8cfe8f1721f3045164d7c72e36ca..65f449eb55262aa1e60afb0bd5b5b2ac919e6fb5 100644 |
--- a/chromeos/dbus/fake_shill_manager_client.h |
+++ b/chromeos/dbus/fake_shill_manager_client.h |
@@ -1,18 +1,25 @@ |
-// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
#ifndef CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_ |
#define CHROMEOS_DBUS_FAKE_SHILL_MANAGER_CLIENT_H_ |
-#include "base/values.h" |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/callback.h" |
+#include "chromeos/chromeos_export.h" |
#include "chromeos/dbus/shill_manager_client.h" |
-#include "chromeos/dbus/shill_property_changed_observer.h" |
namespace chromeos { |
-// A fake implementation of ShillManagerClient. This class does nothing. |
-class FakeShillManagerClient : public ShillManagerClient { |
+// A fake implementation of ShillManagerClient. This works in close coordination |
+// with FakeShillServiceClient. FakeShillDeviceClient, and |
+// FakeShillProfileClient, and is not intended to be used independently. |
+class CHROMEOS_EXPORT FakeShillManagerClient : |
+ public ShillManagerClient, |
+ public ShillManagerClient::TestInterface { |
public: |
FakeShillManagerClient(); |
virtual ~FakeShillManagerClient(); |
@@ -33,23 +40,27 @@ class FakeShillManagerClient : public ShillManagerClient { |
virtual void RequestScan(const std::string& type, |
const base::Closure& callback, |
const ErrorCallback& error_callback) OVERRIDE; |
- virtual void EnableTechnology(const std::string& type, |
- const base::Closure& callback, |
- const ErrorCallback& error_callback) OVERRIDE; |
- virtual void DisableTechnology(const std::string& type, |
- const base::Closure& callback, |
- const ErrorCallback& error_callback) OVERRIDE; |
- virtual void ConfigureService(const base::DictionaryValue& properties, |
- const ObjectPathCallback& callback, |
- const ErrorCallback& error_callback) OVERRIDE; |
+ virtual void EnableTechnology( |
+ const std::string& type, |
+ const base::Closure& callback, |
+ const ErrorCallback& error_callback) OVERRIDE; |
+ virtual void DisableTechnology( |
+ const std::string& type, |
+ const base::Closure& callback, |
+ const ErrorCallback& error_callback) OVERRIDE; |
+ virtual void ConfigureService( |
+ const base::DictionaryValue& properties, |
+ const ObjectPathCallback& callback, |
+ const ErrorCallback& error_callback) OVERRIDE; |
virtual void ConfigureServiceForProfile( |
const dbus::ObjectPath& profile_path, |
const base::DictionaryValue& properties, |
const ObjectPathCallback& callback, |
const ErrorCallback& error_callback) OVERRIDE; |
- virtual void GetService(const base::DictionaryValue& properties, |
- const ObjectPathCallback& callback, |
- const ErrorCallback& error_callback) OVERRIDE; |
+ virtual void GetService( |
+ const base::DictionaryValue& properties, |
+ const ObjectPathCallback& callback, |
+ const ErrorCallback& error_callback) OVERRIDE; |
virtual void VerifyDestination(const VerificationProperties& properties, |
const BooleanCallback& callback, |
const ErrorCallback& error_callback) OVERRIDE; |
@@ -66,9 +77,55 @@ class FakeShillManagerClient : public ShillManagerClient { |
virtual void ConnectToBestServices( |
const base::Closure& callback, |
const ErrorCallback& error_callback) OVERRIDE; |
- virtual TestInterface* GetTestInterface() OVERRIDE; |
+ virtual ShillManagerClient::TestInterface* GetTestInterface() OVERRIDE; |
+ |
+ // ShillManagerClient::TestInterface overrides. |
+ virtual void AddDevice(const std::string& device_path) OVERRIDE; |
+ virtual void RemoveDevice(const std::string& device_path) OVERRIDE; |
+ virtual void ClearDevices() OVERRIDE; |
+ virtual void AddTechnology(const std::string& type, bool enabled) OVERRIDE; |
+ virtual void RemoveTechnology(const std::string& type) OVERRIDE; |
+ virtual void SetTechnologyInitializing(const std::string& type, |
+ bool initializing) OVERRIDE; |
+ virtual void AddGeoNetwork(const std::string& technology, |
+ const base::DictionaryValue& network) OVERRIDE; |
+ virtual void AddProfile(const std::string& profile_path) OVERRIDE; |
+ virtual void ClearProperties() OVERRIDE; |
+ virtual void AddManagerService(const std::string& service_path, |
+ bool add_to_visible_list, |
+ bool add_to_watch_list) OVERRIDE; |
+ virtual void RemoveManagerService(const std::string& service_path) OVERRIDE; |
+ virtual void ClearManagerServices() OVERRIDE; |
+ virtual void SortManagerServices() OVERRIDE; |
private: |
+ void AddServiceToWatchList(const std::string& service_path); |
+ void SetDefaultProperties(); |
+ void PassStubProperties(const DictionaryValueCallback& callback) const; |
+ void PassStubGeoNetworks(const DictionaryValueCallback& callback) const; |
+ void CallNotifyObserversPropertyChanged(const std::string& property, |
+ int delay_ms); |
+ void NotifyObserversPropertyChanged(const std::string& property); |
+ base::ListValue* GetListProperty(const std::string& property); |
+ bool TechnologyEnabled(const std::string& type) const; |
+ void SetTechnologyEnabled(const std::string& type, |
+ const base::Closure& callback, |
+ bool enabled); |
+ base::ListValue* GetEnabledServiceList(const std::string& property) const; |
+ void ScanCompleted(const std::string& device_path, |
+ const base::Closure& callback); |
+ |
+ // Dictionary of property name -> property value |
+ base::DictionaryValue stub_properties_; |
+ // Dictionary of technology -> list of property dictionaries |
+ base::DictionaryValue stub_geo_networks_; |
+ |
+ ObserverList<ShillPropertyChangedObserver> observer_list_; |
+ |
+ // Note: This should remain the last member so it'll be destroyed and |
+ // invalidate its weak pointers before any other members are destroyed. |
+ base::WeakPtrFactory<FakeShillManagerClient> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(FakeShillManagerClient); |
}; |