Add FlimflamDeviceClient

BUG=chromium-os:16557
TEST=chromeos_unittests --gtest_filter="FlimflamDeviceClientTest.*"


Review URL: http://codereview.chromium.org/10095004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132538 0039d316-1c4b-4281-b951-d872f2087c98
parent 65208a08
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
'dbus/flimflam_ipconfig_client.h', 'dbus/flimflam_ipconfig_client.h',
'dbus/flimflam_client_helper.cc', 'dbus/flimflam_client_helper.cc',
'dbus/flimflam_client_helper.h', 'dbus/flimflam_client_helper.h',
'dbus/flimflam_device_client.cc',
'dbus/flimflam_device_client.h',
'dbus/flimflam_manager_client.cc', 'dbus/flimflam_manager_client.cc',
'dbus/flimflam_manager_client.h', 'dbus/flimflam_manager_client.h',
'dbus/flimflam_network_client.cc', 'dbus/flimflam_network_client.cc',
...@@ -105,6 +107,8 @@ ...@@ -105,6 +107,8 @@
'dbus/mock_dbus_thread_manager.h', 'dbus/mock_dbus_thread_manager.h',
'dbus/mock_debug_daemon_client.cc', 'dbus/mock_debug_daemon_client.cc',
'dbus/mock_debug_daemon_client.h', 'dbus/mock_debug_daemon_client.h',
'dbus/mock_flimflam_device_client.cc',
'dbus/mock_flimflam_device_client.h',
'dbus/mock_flimflam_ipconfig_client.cc', 'dbus/mock_flimflam_ipconfig_client.cc',
'dbus/mock_flimflam_ipconfig_client.h', 'dbus/mock_flimflam_ipconfig_client.h',
'dbus/mock_flimflam_manager_client.cc', 'dbus/mock_flimflam_manager_client.cc',
...@@ -146,6 +150,7 @@ ...@@ -146,6 +150,7 @@
'dbus/blocking_method_caller_unittest.cc', 'dbus/blocking_method_caller_unittest.cc',
'dbus/flimflam_client_unittest_base.cc', 'dbus/flimflam_client_unittest_base.cc',
'dbus/flimflam_client_unittest_base.h', 'dbus/flimflam_client_unittest_base.h',
'dbus/flimflam_device_client_unittest.cc',
'dbus/flimflam_manager_client_unittest.cc', 'dbus/flimflam_manager_client_unittest.cc',
'dbus/flimflam_network_client_unittest.cc', 'dbus/flimflam_network_client_unittest.cc',
'dbus/flimflam_profile_client_unittest.cc', 'dbus/flimflam_profile_client_unittest.cc',
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_client_implementation_type.h" #include "chromeos/dbus/dbus_client_implementation_type.h"
#include "chromeos/dbus/debug_daemon_client.h" #include "chromeos/dbus/debug_daemon_client.h"
#include "chromeos/dbus/flimflam_device_client.h"
#include "chromeos/dbus/flimflam_ipconfig_client.h" #include "chromeos/dbus/flimflam_ipconfig_client.h"
#include "chromeos/dbus/flimflam_manager_client.h" #include "chromeos/dbus/flimflam_manager_client.h"
#include "chromeos/dbus/flimflam_network_client.h" #include "chromeos/dbus/flimflam_network_client.h"
...@@ -77,6 +78,9 @@ class DBusThreadManagerImpl : public DBusThreadManager { ...@@ -77,6 +78,9 @@ class DBusThreadManagerImpl : public DBusThreadManager {
// Create the debugdaemon client. // Create the debugdaemon client.
debugdaemon_client_.reset( debugdaemon_client_.reset(
DebugDaemonClient::Create(client_type, system_bus_.get())); DebugDaemonClient::Create(client_type, system_bus_.get()));
// Create the Flimflam Device client.
flimflam_device_client_.reset(
FlimflamDeviceClient::Create(client_type, system_bus_.get()));
// Create the Flimflam IPConfig client. // Create the Flimflam IPConfig client.
flimflam_ipconfig_client_.reset( flimflam_ipconfig_client_.reset(
FlimflamIPConfigClient::Create(client_type, system_bus_.get())); FlimflamIPConfigClient::Create(client_type, system_bus_.get()));
...@@ -168,6 +172,11 @@ class DBusThreadManagerImpl : public DBusThreadManager { ...@@ -168,6 +172,11 @@ class DBusThreadManagerImpl : public DBusThreadManager {
return debugdaemon_client_.get(); return debugdaemon_client_.get();
} }
// DBusThreadManager override.
virtual FlimflamDeviceClient* GetFlimflamDeviceClient() OVERRIDE {
return flimflam_device_client_.get();
}
// DBusThreadManager override. // DBusThreadManager override.
virtual FlimflamIPConfigClient* GetFlimflamIPConfigClient() OVERRIDE { virtual FlimflamIPConfigClient* GetFlimflamIPConfigClient() OVERRIDE {
return flimflam_ipconfig_client_.get(); return flimflam_ipconfig_client_.get();
...@@ -229,6 +238,7 @@ class DBusThreadManagerImpl : public DBusThreadManager { ...@@ -229,6 +238,7 @@ class DBusThreadManagerImpl : public DBusThreadManager {
scoped_ptr<CrosDisksClient> cros_disks_client_; scoped_ptr<CrosDisksClient> cros_disks_client_;
scoped_ptr<CryptohomeClient> cryptohome_client_; scoped_ptr<CryptohomeClient> cryptohome_client_;
scoped_ptr<DebugDaemonClient> debugdaemon_client_; scoped_ptr<DebugDaemonClient> debugdaemon_client_;
scoped_ptr<FlimflamDeviceClient> flimflam_device_client_;
scoped_ptr<FlimflamIPConfigClient> flimflam_ipconfig_client_; scoped_ptr<FlimflamIPConfigClient> flimflam_ipconfig_client_;
scoped_ptr<FlimflamManagerClient> flimflam_manager_client_; scoped_ptr<FlimflamManagerClient> flimflam_manager_client_;
scoped_ptr<FlimflamNetworkClient> flimflam_network_client_; scoped_ptr<FlimflamNetworkClient> flimflam_network_client_;
......
...@@ -30,6 +30,7 @@ class CashewClient; ...@@ -30,6 +30,7 @@ class CashewClient;
class CrosDisksClient; class CrosDisksClient;
class CryptohomeClient; class CryptohomeClient;
class DebugDaemonClient; class DebugDaemonClient;
class FlimflamDeviceClient;
class FlimflamIPConfigClient; class FlimflamIPConfigClient;
class FlimflamManagerClient; class FlimflamManagerClient;
class FlimflamNetworkClient; class FlimflamNetworkClient;
...@@ -126,6 +127,11 @@ class CHROMEOS_EXPORT DBusThreadManager { ...@@ -126,6 +127,11 @@ class CHROMEOS_EXPORT DBusThreadManager {
// down. // down.
virtual DebugDaemonClient* GetDebugDaemonClient() = 0; virtual DebugDaemonClient* GetDebugDaemonClient() = 0;
// Returns the Flimflam Device client, owned by DBusThreadManager.
// Do not cache this pointer and use it after DBusThreadManager is shut
// down.
virtual FlimflamDeviceClient* GetFlimflamDeviceClient() = 0;
// Returns the Flimflam IPConfig client, owned by DBusThreadManager. // Returns the Flimflam IPConfig client, owned by DBusThreadManager.
// Do not cache this pointer and use it after DBusThreadManager is shut // Do not cache this pointer and use it after DBusThreadManager is shut
// down. // down.
......
This diff is collapsed.
// Copyright (c) 2012 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_FLIMFLAM_DEVICE_CLIENT_H_
#define CHROMEOS_DBUS_FLIMFLAM_DEVICE_CLIENT_H_
#include <string>
#include "base/basictypes.h"
#include "base/callback.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/dbus/dbus_client_implementation_type.h"
#include "chromeos/dbus/flimflam_client_helper.h"
namespace base {
class Value;
class DictionaryValue;
} // namespace base
namespace dbus {
class Bus;
class ObjectPath;
} // namespace dbus
namespace chromeos {
// FlimflamDeviceClient is used to communicate with the Flimflam Device service.
// All methods should be called from the origin thread which initializes the
// DBusThreadManager instance.
class CHROMEOS_EXPORT FlimflamDeviceClient {
public:
typedef FlimflamClientHelper::PropertyChangedHandler PropertyChangedHandler;
typedef FlimflamClientHelper::VoidCallback VoidCallback;
typedef FlimflamClientHelper::ObjectPathCallback ObjectPathCallback;
typedef FlimflamClientHelper::DictionaryValueCallback DictionaryValueCallback;
virtual ~FlimflamDeviceClient();
// Factory function, creates a new instance which is owned by the caller.
// For normal usage, access the singleton via DBusThreadManager::Get().
static FlimflamDeviceClient* Create(DBusClientImplementationType type,
dbus::Bus* bus);
// Sets PropertyChanged signal handler.
virtual void SetPropertyChangedHandler(
const dbus::ObjectPath& device_path,
const PropertyChangedHandler& handler) = 0;
// Resets PropertyChanged signal handler.
virtual void ResetPropertyChangedHandler(
const dbus::ObjectPath& device_path) = 0;
// Calls GetProperties method.
// |callback| is called after the method call finishes.
virtual void GetProperties(const dbus::ObjectPath& device_path,
const DictionaryValueCallback& callback) = 0;
// Calls ProposeScan method.
// |callback| is called after the method call finishes.
virtual void ProposeScan(const dbus::ObjectPath& device_path,
const VoidCallback& callback) = 0;
// Calls SetProperty method.
// |callback| is called after the method call finishes.
virtual void SetProperty(const dbus::ObjectPath& device_path,
const std::string& name,
const base::Value& value,
const VoidCallback& callback) = 0;
// Calls ClearProperty method.
// |callback| is called after the method call finishes.
virtual void ClearProperty(const dbus::ObjectPath& device_path,
const std::string& name,
const VoidCallback& callback) = 0;
// Calls AddIPConfig method.
// |callback| is called after the method call finishes.
virtual void AddIPConfig(const dbus::ObjectPath& device_path,
const std::string& method,
const ObjectPathCallback& callback) = 0;
// Calls RequirePin method.
// |callback| is called after the method call finishes.
virtual void RequirePin(const dbus::ObjectPath& device_path,
const std::string& pin,
bool require,
const VoidCallback& callback) = 0;
// Calls EnterPin method.
// |callback| is called after the method call finishes.
virtual void EnterPin(const dbus::ObjectPath& device_path,
const std::string& pin,
const VoidCallback& callback) = 0;
// Calls UnblockPin method.
// |callback| is called after the method call finishes.
virtual void UnblockPin(const dbus::ObjectPath& device_path,
const std::string& puk,
const std::string& pin,
const VoidCallback& callback) = 0;
// Calls ChangePin method.
// |callback| is called after the method call finishes.
virtual void ChangePin(const dbus::ObjectPath& device_path,
const std::string& old_pin,
const std::string& new_pin,
const VoidCallback& callback) = 0;
// Calls Register method.
// |callback| is called after the method call finishes.
virtual void Register(const dbus::ObjectPath& device_path,
const std::string& network_id,
const VoidCallback& callback) = 0;
protected:
// Create() should be used instead.
FlimflamDeviceClient();
private:
DISALLOW_COPY_AND_ASSIGN(FlimflamDeviceClient);
};
} // namespace chromeos
#endif // CHROMEOS_DBUS_FLIMFLAM_DEVICE_CLIENT_H_
// Copyright (c) 2012 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.
#include "base/bind.h"
#include "base/values.h"
#include "chromeos/dbus/flimflam_client_unittest_base.h"
#include "chromeos/dbus/flimflam_device_client.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
#include "dbus/values_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
namespace {
const char kExampleDevicePath[] = "/foo/bar";
// Expects the reader to have a string and a bool.
void ExpectStringAndBoolArguments(const std::string& expected_string,
bool expected_bool,
dbus::MessageReader* reader) {
std::string arg1;
ASSERT_TRUE(reader->PopString(&arg1));
EXPECT_EQ(expected_string, arg1);
bool arg2 = false;
ASSERT_TRUE(reader->PopBool(&arg2));
EXPECT_EQ(expected_bool, arg2);
EXPECT_FALSE(reader->HasMoreData());
}
// Expects the reader to have two strings.
void ExpectTwoStringArguments(const std::string& expected_string1,
const std::string& expected_string2,
dbus::MessageReader* reader) {
std::string arg1;
ASSERT_TRUE(reader->PopString(&arg1));
EXPECT_EQ(expected_string1, arg1);
std::string arg2;
ASSERT_TRUE(reader->PopString(&arg2));
EXPECT_EQ(expected_string2, arg2);
EXPECT_FALSE(reader->HasMoreData());
}
} // namespace
class FlimflamDeviceClientTest : public FlimflamClientUnittestBase {
public:
FlimflamDeviceClientTest()
: FlimflamClientUnittestBase(flimflam::kFlimflamDeviceInterface,
dbus::ObjectPath(kExampleDevicePath)) {
}
virtual void SetUp() {
FlimflamClientUnittestBase::SetUp();
// Create a client with the mock bus.
client_.reset(FlimflamDeviceClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION,
mock_bus_));
// Run the message loop to run the signal connection result callback.
message_loop_.RunAllPending();
}
virtual void TearDown() {
FlimflamClientUnittestBase::TearDown();
}
protected:
scoped_ptr<FlimflamDeviceClient> client_;
};
TEST_F(FlimflamDeviceClientTest, PropertyChanged) {
const bool kValue = true;
// Create a signal.
dbus::Signal signal(flimflam::kFlimflamDeviceInterface,
flimflam::kMonitorPropertyChanged);
dbus::MessageWriter writer(&signal);
writer.AppendString(flimflam::kCellularAllowRoamingProperty);
writer.AppendVariantOfBool(kValue);
// Set expectations.
const base::FundamentalValue value(kValue);
client_->SetPropertyChangedHandler(
dbus::ObjectPath(kExampleDevicePath),
base::Bind(&ExpectPropertyChanged,
flimflam::kCellularAllowRoamingProperty,
&value));
// Run the signal callback.
SendPropertyChangedSignal(&signal);
// Reset the handler.
client_->ResetPropertyChangedHandler(dbus::ObjectPath(kExampleDevicePath));
}
TEST_F(FlimflamDeviceClientTest, GetProperties) {
const bool kValue = true;
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
dbus::MessageWriter writer(response.get());
dbus::MessageWriter array_writer(NULL);
writer.OpenArray("{sv}", &array_writer);
dbus::MessageWriter entry_writer(NULL);
array_writer.OpenDictEntry(&entry_writer);
entry_writer.AppendString(flimflam::kCellularAllowRoamingProperty);
entry_writer.AppendVariantOfBool(kValue);
array_writer.CloseContainer(&entry_writer);
writer.CloseContainer(&array_writer);
// Set expectations.
base::DictionaryValue value;
value.SetWithoutPathExpansion(flimflam::kCellularAllowRoamingProperty,
base::Value::CreateBooleanValue(kValue));
PrepareForMethodCall(flimflam::kGetPropertiesFunction,
base::Bind(&ExpectNoArgument),
response.get());
// Call method.
client_->GetProperties(dbus::ObjectPath(kExampleDevicePath),
base::Bind(&ExpectDictionaryValueResult, &value));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, ProposeScan) {
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
PrepareForMethodCall(flimflam::kProposeScanFunction,
base::Bind(&ExpectNoArgument),
response.get());
// Call method.
client_->ProposeScan(dbus::ObjectPath(kExampleDevicePath),
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, SetProperty) {
const bool kValue = true;
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
const base::FundamentalValue value(kValue);
PrepareForMethodCall(flimflam::kSetPropertyFunction,
base::Bind(&ExpectStringAndValueArguments,
flimflam::kCellularAllowRoamingProperty,
&value),
response.get());
// Call method.
client_->SetProperty(dbus::ObjectPath(kExampleDevicePath),
flimflam::kCellularAllowRoamingProperty,
value,
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, ClearProperty) {
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
PrepareForMethodCall(flimflam::kClearPropertyFunction,
base::Bind(&ExpectStringArgument,
flimflam::kCellularAllowRoamingProperty),
response.get());
// Call method.
client_->ClearProperty(dbus::ObjectPath(kExampleDevicePath),
flimflam::kCellularAllowRoamingProperty,
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, RequirePin) {
const char kPin[] = "123456";
const bool kRequired = true;
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
PrepareForMethodCall(flimflam::kRequirePinFunction,
base::Bind(&ExpectStringAndBoolArguments,
kPin,
kRequired),
response.get());
// Call method.
client_->RequirePin(dbus::ObjectPath(kExampleDevicePath),
kPin,
kRequired,
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, EnterPin) {
const char kPin[] = "123456";
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
PrepareForMethodCall(flimflam::kEnterPinFunction,
base::Bind(&ExpectStringArgument,
kPin),
response.get());
// Call method.
client_->EnterPin(dbus::ObjectPath(kExampleDevicePath),
kPin,
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, UnblockPin) {
const char kPuk[] = "987654";
const char kPin[] = "123456";
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
PrepareForMethodCall(flimflam::kUnblockPinFunction,
base::Bind(&ExpectTwoStringArguments, kPuk, kPin),
response.get());
// Call method.
client_->UnblockPin(dbus::ObjectPath(kExampleDevicePath),
kPuk,
kPin,
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, ChangePin) {
const char kOldPin[] = "123456";
const char kNewPin[] = "234567";
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
PrepareForMethodCall(flimflam::kChangePinFunction,
base::Bind(&ExpectTwoStringArguments,
kOldPin,
kNewPin),
response.get());
// Call method.
client_->ChangePin(dbus::ObjectPath(kExampleDevicePath),
kOldPin,
kNewPin,
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
TEST_F(FlimflamDeviceClientTest, Register) {
const char kNetworkId[] = "networkid";
// Create response.
scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
// Set expectations.
PrepareForMethodCall(flimflam::kRegisterFunction,
base::Bind(&ExpectStringArgument, kNetworkId),
response.get());
// Call method.
client_->Register(dbus::ObjectPath(kExampleDevicePath),
kNetworkId,
base::Bind(&ExpectNoResultValue));
// Run the message loop.
message_loop_.RunAllPending();
}
} // namespace chromeos
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "chromeos/dbus/mock_cros_disks_client.h" #include "chromeos/dbus/mock_cros_disks_client.h"
#include "chromeos/dbus/mock_cryptohome_client.h" #include "chromeos/dbus/mock_cryptohome_client.h"
#include "chromeos/dbus/mock_debug_daemon_client.h" #include "chromeos/dbus/mock_debug_daemon_client.h"
#include "chromeos/dbus/mock_flimflam_device_client.h"
#include "chromeos/dbus/mock_flimflam_ipconfig_client.h" #include "chromeos/dbus/mock_flimflam_ipconfig_client.h"
#include "chromeos/dbus/mock_flimflam_manager_client.h" #include "chromeos/dbus/mock_flimflam_manager_client.h"
#include "chromeos/dbus/mock_flimflam_network_client.h" #include "chromeos/dbus/mock_flimflam_network_client.h"
...@@ -40,6 +41,7 @@ MockDBusThreadManager::MockDBusThreadManager() ...@@ -40,6 +41,7 @@ MockDBusThreadManager::MockDBusThreadManager()
mock_cros_disks_client_(new MockCrosDisksClient), mock_cros_disks_client_(new MockCrosDisksClient),
mock_cryptohome_client_(new MockCryptohomeClient), mock_cryptohome_client_(new MockCryptohomeClient),
mock_debugdaemon_client_(new MockDebugDaemonClient), mock_debugdaemon_client_(new MockDebugDaemonClient),
mock_flimflam_device_client_(new MockFlimflamDeviceClient),
mock_flimflam_ipconfig_client_(new MockFlimflamIPConfigClient), mock_flimflam_ipconfig_client_(new MockFlimflamIPConfigClient),
mock_flimflam_manager_client_(new MockFlimflamManagerClient), mock_flimflam_manager_client_(new MockFlimflamManagerClient),
mock_flimflam_network_client_(new MockFlimflamNetworkClient), mock_flimflam_network_client_(new MockFlimflamNetworkClient),
...@@ -68,6 +70,8 @@ MockDBusThreadManager::MockDBusThreadManager() ...@@ -68,6 +70,8 @@ MockDBusThreadManager::MockDBusThreadManager()
.WillRepeatedly(Return(mock_cryptohome_client())); .WillRepeatedly(Return(mock_cryptohome_client()));
EXPECT_CALL(*this, GetDebugDaemonClient()) EXPECT_CALL(*this, GetDebugDaemonClient())
.WillRepeatedly(Return(mock_debugdaemon_client())); .WillRepeatedly(Return(mock_debugdaemon_client()));
EXPECT_CALL(*this, GetFlimflamDeviceClient())
.WillRepeatedly(Return(mock_flimflam_device_client()));
EXPECT_CALL(*this, GetFlimflamIPConfigClient()) EXPECT_CALL(*this, GetFlimflamIPConfigClient())
.WillRepeatedly(Return(mock_flimflam_ipconfig_client())); .WillRepeatedly(Return(mock_flimflam_ipconfig_client()));
EXPECT_CALL(*this, GetFlimflamManagerClient()) EXPECT_CALL(*this, GetFlimflamManagerClient())
......
...@@ -27,6 +27,7 @@ class MockCashewClient; ...@@ -27,6 +27,7 @@ class MockCashewClient;
class MockCrosDisksClient; class MockCrosDisksClient;
class MockCryptohomeClient; class MockCryptohomeClient;
class MockDebugDaemonClient; class MockDebugDaemonClient;
class MockFlimflamDeviceClient;
class MockFlimflamIPConfigClient; class MockFlimflamIPConfigClient;
class MockFlimflamManagerClient; class MockFlimflamManagerClient;
class MockFlimflamNetworkClient; class MockFlimflamNetworkClient;
...@@ -56,6 +57,7 @@ class MockDBusThreadManager : public DBusThreadManager { ...@@ -56,6 +57,7 @@ class MockDBusThreadManager : public DBusThreadManager {
MOCK_METHOD0(GetCrosDisksClient, CrosDisksClient*(void)); MOCK_METHOD0(GetCrosDisksClient, CrosDisksClient*(void));
MOCK_METHOD0(GetCryptohomeClient, CryptohomeClient*(void)); MOCK_METHOD0(GetCryptohomeClient, CryptohomeClient*(void));
MOCK_METHOD0(GetDebugDaemonClient, DebugDaemonClient*(void)); MOCK_METHOD0(GetDebugDaemonClient, DebugDaemonClient*(void));
MOCK_METHOD0(GetFlimflamDeviceClient, FlimflamDeviceClient*(void));
MOCK_METHOD0(GetFlimflamIPConfigClient, FlimflamIPConfigClient*(void)); MOCK_METHOD0(GetFlimflamIPConfigClient, FlimflamIPConfigClient*(void));
MOCK_METHOD0(GetFlimflamManagerClient, FlimflamManagerClient*(void)); MOCK_METHOD0(GetFlimflamManagerClient, FlimflamManagerClient*(void));
MOCK_METHOD0(GetFlimflamNetworkClient, FlimflamNetworkClient*(void)); MOCK_METHOD0(GetFlimflamNetworkClient, FlimflamNetworkClient*(void));
...@@ -94,6 +96,9 @@ class MockDBusThreadManager : public DBusThreadManager { ...@@ -94,6 +96,9 @@ class MockDBusThreadManager : public DBusThreadManager {
MockDebugDaemonClient* mock_debugdaemon_client() { MockDebugDaemonClient* mock_debugdaemon_client() {
return mock_debugdaemon_client_.get(); return mock_debugdaemon_client_.get();
} }
MockFlimflamDeviceClient* mock_flimflam_device_client() {
return mock_flimflam_device_client_.get();
}
MockFlimflamIPConfigClient* mock_flimflam_ipconfig_client() { MockFlimflamIPConfigClient* mock_flimflam_ipconfig_client() {
return mock_flimflam_ipconfig_client_.get(); return mock_flimflam_ipconfig_client_.get();
} }
...@@ -135,6 +140,7 @@ class MockDBusThreadManager : public DBusThreadManager { ...@@ -135,6 +140,7 @@ class MockDBusThreadManager : public DBusThreadManager {
scoped_ptr<MockCrosDisksClient> mock_cros_disks_client_; scoped_ptr<MockCrosDisksClient> mock_cros_disks_client_;
scoped_ptr<MockCryptohomeClient> mock_cryptohome_client_; scoped_ptr<MockCryptohomeClient> mock_cryptohome_client_;
scoped_ptr<MockDebugDaemonClient> mock_debugdaemon_client_; scoped_ptr<MockDebugDaemonClient> mock_debugdaemon_client_;
scoped_ptr<MockFlimflamDeviceClient> mock_flimflam_device_client_;
scoped_ptr<MockFlimflamIPConfigClient> mock_flimflam_ipconfig_client_; scoped_ptr<MockFlimflamIPConfigClient> mock_flimflam_ipconfig_client_;
scoped_ptr<MockFlimflamManagerClient> mock_flimflam_manager_client_; scoped_ptr<MockFlimflamManagerClient> mock_flimflam_manager_client_;
scoped_ptr<MockFlimflamNetworkClient> mock_flimflam_network_client_; scoped_ptr<MockFlimflamNetworkClient> mock_flimflam_network_client_;
......
// Copyright (c) 2012 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.
#include "chromeos/dbus/mock_flimflam_device_client.h"
namespace chromeos {
MockFlimflamDeviceClient::MockFlimflamDeviceClient() {}
MockFlimflamDeviceClient::~MockFlimflamDeviceClient() {}
} // namespace chromeos
// Copyright (c) 2012 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_MOCK_FLIMFLAM_DEVICE_CLIENT_H_
#define CHROMEOS_DBUS_MOCK_FLIMFLAM_DEVICE_CLIENT_H_
#include "base/values.h"
#include "chromeos/dbus/flimflam_device_client.h"
#include "dbus/object_path.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class MockFlimflamDeviceClient : public FlimflamDeviceClient {
public:
MockFlimflamDeviceClient();
virtual ~MockFlimflamDeviceClient();
MOCK_METHOD2(SetPropertyChangedHandler,
void(const dbus::ObjectPath& device_path,
const PropertyChangedHandler& handler));
MOCK_METHOD1(ResetPropertyChangedHandler,
void(const dbus::ObjectPath& device_path));
MOCK_METHOD2(GetProperties, void(const dbus::ObjectPath& device_path,
const DictionaryValueCallback& callback));
MOCK_METHOD2(ProposeScan, void(const dbus::ObjectPath& device_path,
const VoidCallback& callback));
MOCK_METHOD4(SetProperty, void(const dbus::ObjectPath& device_path,
const std::string& name,
const base::Value& value,
const VoidCallback& callback));
MOCK_METHOD3(ClearProperty, void(const dbus::ObjectPath& device_path,
const std::string& name,
const VoidCallback& callback));
MOCK_METHOD3(AddIPConfig, void(const dbus::ObjectPath& device_path,
const std::string& method,
const ObjectPathCallback& callback));
MOCK_METHOD4(RequirePin, void(const dbus::ObjectPath& device_path,
const std::string& pin,
bool require,
const VoidCallback& callback));
MOCK_METHOD3(EnterPin, void(const dbus::ObjectPath& device_path,
const std::string& pin,
const VoidCallback& callback));
MOCK_METHOD4(UnblockPin, void(const dbus::ObjectPath& device_path,
const std::string& puk,
const std::string& pin,
const VoidCallback& callback));
MOCK_METHOD4(ChangePin, void(const dbus::ObjectPath& device_path,
const std::string& old_pin,
const std::string& new_pin,
const VoidCallback& callback));
MOCK_METHOD3(Register, void(const dbus::ObjectPath& device_path,
const std::string& network_id,
const VoidCallback& callback));
};
} // namespace chromeos
#endif // CHROMEOS_DBUS_MOCK_FLIMFLAM_DEVICE_CLIENT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment