Commit d96e7e94 authored by satorux@chromium.org's avatar satorux@chromium.org

chromeos: Add MockDBusThreadManager and mock clients.

I thought we wouldn't need a mock for this, but I was wrong.
To properly fix crosbug.com/22183, we need to mock out DBusThreadManager.
As always, it's never too late to do the right thing.

BUG=chromium-os:22197
TEST=D-Bus functions work as before (brightness change keys work)

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107853 0039d316-1c4b-4281-b951-d872f2087c98
parent cc63025a
...@@ -20,71 +20,132 @@ namespace chromeos { ...@@ -20,71 +20,132 @@ namespace chromeos {
static DBusThreadManager* g_dbus_thread_manager = NULL; static DBusThreadManager* g_dbus_thread_manager = NULL;
DBusThreadManager::DBusThreadManager() { // The DBusThreadManager implementation used in production.
// Create the D-Bus thread. class DBusThreadManagerImpl : public DBusThreadManager {
base::Thread::Options thread_options; public:
thread_options.message_loop_type = MessageLoop::TYPE_IO; DBusThreadManagerImpl() {
dbus_thread_.reset(new base::Thread("D-Bus thread")); // Create the D-Bus thread.
dbus_thread_->StartWithOptions(thread_options); base::Thread::Options thread_options;
thread_options.message_loop_type = MessageLoop::TYPE_IO;
// Create the connection to the system bus. dbus_thread_.reset(new base::Thread("D-Bus thread"));
dbus::Bus::Options system_bus_options; dbus_thread_->StartWithOptions(thread_options);
system_bus_options.bus_type = dbus::Bus::SYSTEM;
system_bus_options.connection_type = dbus::Bus::PRIVATE; // Create the connection to the system bus.
system_bus_options.dbus_thread_message_loop_proxy = dbus::Bus::Options system_bus_options;
dbus_thread_->message_loop_proxy(); system_bus_options.bus_type = dbus::Bus::SYSTEM;
system_bus_ = new dbus::Bus(system_bus_options); system_bus_options.connection_type = dbus::Bus::PRIVATE;
system_bus_options.dbus_thread_message_loop_proxy =
// Create and start the cros D-Bus service. dbus_thread_->message_loop_proxy();
cros_dbus_service_.reset(CrosDBusService::Create(system_bus_.get())); system_bus_ = new dbus::Bus(system_bus_options);
cros_dbus_service_->Start();
// Create and start the cros D-Bus service.
// Start monitoring sensors if needed. cros_dbus_service_.reset(CrosDBusService::Create(system_bus_.get()));
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); cros_dbus_service_->Start();
if (command_line.HasSwitch(switches::kEnableSensors)) {
sensors_client_.reset(SensorsClient::Create(system_bus_.get())); // Start monitoring sensors if needed.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kEnableSensors))
sensors_client_.reset(SensorsClient::Create(system_bus_.get()));
// Create bluetooth clients if bluetooth is enabled.
if (command_line.HasSwitch(switches::kEnableBluetooth)) {
bluetooth_manager_client_.reset(BluetoothManagerClient::Create(
system_bus_.get()));
bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create(
system_bus_.get()));
}
// Create the power manager client.
power_manager_client_.reset(PowerManagerClient::Create(system_bus_.get()));
// Create the session manager client.
session_manager_client_.reset(
SessionManagerClient::Create(system_bus_.get()));
// Create the speech synthesizer client.
speech_synthesizer_client_.reset(
SpeechSynthesizerClient::Create(system_bus_.get()));
} }
// Create bluetooth clients if bluetooth is enabled. virtual ~DBusThreadManagerImpl() {
if (command_line.HasSwitch(switches::kEnableBluetooth)) { // Shut down the bus. During the browser shutdown, it's ok to shut down
bluetooth_manager_client_.reset(BluetoothManagerClient::Create( // the bus synchronously.
system_bus_.get())); system_bus_->ShutdownOnDBusThreadAndBlock();
bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create(
system_bus_.get())); // Stop the D-Bus thread.
dbus_thread_->Stop();
} }
// Create the power manager client. // DBusThreadManager override.
power_manager_client_.reset(PowerManagerClient::Create(system_bus_.get())); virtual BluetoothAdapterClient* bluetooth_adapter_client() OVERRIDE {
// Create the session manager client. return bluetooth_adapter_client_.get();
session_manager_client_.reset( }
SessionManagerClient::Create(system_bus_.get()));
// Create the speech synthesizer client.
speech_synthesizer_client_.reset(
SpeechSynthesizerClient::Create(system_bus_.get()));
}
DBusThreadManager::~DBusThreadManager() { // DBusThreadManager override.
// Shut down the bus. During the browser shutdown, it's ok to shut down virtual BluetoothManagerClient* bluetooth_manager_client() OVERRIDE {
// the bus synchronously. return bluetooth_manager_client_.get();
system_bus_->ShutdownOnDBusThreadAndBlock(); }
// Stop the D-Bus thread. // DBusThreadManager override.
dbus_thread_->Stop(); virtual PowerManagerClient* power_manager_client() OVERRIDE {
} return power_manager_client_.get();
}
// DBusThreadManager override.
virtual SensorsClient* sensors_client() OVERRIDE {
return sensors_client_.get();
}
// DBusThreadManager override.
virtual SessionManagerClient* session_manager_client() OVERRIDE {
return session_manager_client_.get();
}
// DBusThreadManager override.
virtual SpeechSynthesizerClient* speech_synthesizer_client() OVERRIDE {
return speech_synthesizer_client_.get();
}
// DBusThreadManager override.
virtual void set_session_manager_client_for_testing(
SessionManagerClient* session_manager_client) OVERRIDE {
session_manager_client_.reset(session_manager_client);
}
scoped_ptr<base::Thread> dbus_thread_;
scoped_refptr<dbus::Bus> system_bus_;
scoped_ptr<CrosDBusService> cros_dbus_service_;
scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_;
scoped_ptr<PowerManagerClient> power_manager_client_;
scoped_ptr<SensorsClient> sensors_client_;
scoped_ptr<SessionManagerClient> session_manager_client_;
scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_;
};
// static
void DBusThreadManager::Initialize() { void DBusThreadManager::Initialize() {
if (g_dbus_thread_manager) { if (g_dbus_thread_manager) {
// This can happen in tests. LOG(WARNING) << "DBusThreadManager was already initialized";
LOG(WARNING) << "DBusThreadManager::Initialize() was already called"; return;
}
g_dbus_thread_manager = new DBusThreadManagerImpl;
VLOG(1) << "DBusThreadManager initialized";
}
// static
void DBusThreadManager::InitializeForTesting(
DBusThreadManager* dbus_thread_manager) {
if (g_dbus_thread_manager) {
LOG(WARNING) << "DBusThreadManager was already initialized";
return; return;
} }
g_dbus_thread_manager = new DBusThreadManager; g_dbus_thread_manager = dbus_thread_manager;
VLOG(1) << "DBusThreadManager initialized"; VLOG(1) << "DBusThreadManager initialized";
} }
// static
void DBusThreadManager::Shutdown() { void DBusThreadManager::Shutdown() {
if (!g_dbus_thread_manager) { if (!g_dbus_thread_manager) {
// This can happen in tests. // TODO(satorux): Make it a DCHECK() once it's ready.
LOG(WARNING) << "DBusThreadManager::Shutdown() called with NULL manager"; LOG(WARNING) << "DBusThreadManager::Shutdown() called with NULL manager";
return; return;
} }
...@@ -93,15 +154,17 @@ void DBusThreadManager::Shutdown() { ...@@ -93,15 +154,17 @@ void DBusThreadManager::Shutdown() {
VLOG(1) << "DBusThreadManager Shutdown completed"; VLOG(1) << "DBusThreadManager Shutdown completed";
} }
DBusThreadManager::DBusThreadManager() {
}
DBusThreadManager::~DBusThreadManager() {
}
// static
DBusThreadManager* DBusThreadManager::Get() { DBusThreadManager* DBusThreadManager::Get() {
CHECK(g_dbus_thread_manager) CHECK(g_dbus_thread_manager)
<< "DBusThreadManager::Get() called before Initialize()"; << "DBusThreadManager::Get() called before Initialize()";
return g_dbus_thread_manager; return g_dbus_thread_manager;
} }
void DBusThreadManager::set_session_manager_client_for_testing(
SessionManagerClient* session_manager_client) {
session_manager_client_.reset(session_manager_client);
}
} // namespace chromeos } // namespace chromeos
...@@ -52,64 +52,62 @@ class DBusThreadManager { ...@@ -52,64 +52,62 @@ class DBusThreadManager {
// making it a Singleton, to ensure clean startup and shutdown. // making it a Singleton, to ensure clean startup and shutdown.
static void Initialize(); static void Initialize();
// Similar to Initialize(), but can inject an alternative
// DBusThreadManager such as MockDBusThreadManager for testing.
// The injected object will be owned by the internal pointer and deleted
// by Shutdown().
static void InitializeForTesting(DBusThreadManager* dbus_thread_manager);
// Destroys the global instance. // Destroys the global instance.
static void Shutdown(); static void Shutdown();
// Gets the global instance. Initialize() must be called first. // Gets the global instance. Initialize() must be called first.
static DBusThreadManager* Get(); static DBusThreadManager* Get();
// Returns the bluetooth manager client, owned by DBusThreadManager. // TODO(satorux): Rename the following getters to something like
// GetFooClient() as they are now virtual.
// Returns the bluetooth adapter 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.
BluetoothManagerClient* bluetooth_manager_client() { virtual BluetoothAdapterClient* bluetooth_adapter_client() = 0;
return bluetooth_manager_client_.get();
}
// Returns the bluetooth adapter client, owned by DBusThreadManager. // Returns the bluetooth manager 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.
BluetoothAdapterClient* bluetooth_adapter_client() { virtual BluetoothManagerClient* bluetooth_manager_client() = 0;
return bluetooth_adapter_client_.get();
}
// Returns the power manager client, owned by DBusThreadManager. // Returns the power manager client, owned by DBusThreadManager.
// See also comments at session_manager_client(). // See also comments at session_manager_client().
PowerManagerClient* power_manager_client() { virtual PowerManagerClient* power_manager_client() = 0;
return power_manager_client_.get();
}
// Returns the session manager client, owned by DBusThreadManager. // Returns the session manager 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.
SessionManagerClient* session_manager_client() { virtual SensorsClient* sensors_client() = 0;
return session_manager_client_.get();
} // Returns the session manager client, owned by DBusThreadManager.
// Do not cache this pointer and use it after DBusThreadManager is shut
// down.
virtual SessionManagerClient* session_manager_client() = 0;
// Sets the session manager client. Takes the ownership. // Sets the session manager client. Takes the ownership.
// The function is exported for testing. // The function is exported for testing.
void set_session_manager_client_for_testing( //
SessionManagerClient* session_manager_client); // TODO(satorux): Remove this once we convert tests to use
// MockDBusThreadManager.
virtual void set_session_manager_client_for_testing(
SessionManagerClient* session_manager_client) = 0;
// Returns the speech synthesizer client, owned by DBusThreadManager. // Returns the speech synthesizer 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.
SpeechSynthesizerClient* speech_synthesizer_client() { virtual SpeechSynthesizerClient* speech_synthesizer_client() = 0;
return speech_synthesizer_client_.get();
}
private:
DBusThreadManager();
virtual ~DBusThreadManager(); virtual ~DBusThreadManager();
scoped_ptr<base::Thread> dbus_thread_; protected:
scoped_refptr<dbus::Bus> system_bus_; DBusThreadManager();
scoped_ptr<CrosDBusService> cros_dbus_service_;
scoped_ptr<SensorsClient> sensors_client_;
scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_;
scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
scoped_ptr<PowerManagerClient> power_manager_client_;
scoped_ptr<SessionManagerClient> session_manager_client_;
scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_;
DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); DISALLOW_COPY_AND_ASSIGN(DBusThreadManager);
}; };
......
// Copyright (c) 2011 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 "chrome/browser/chromeos/dbus/mock_bluetooth_adapter_client.h"
namespace chromeos {
MockBluetoothAdapterClient::MockBluetoothAdapterClient() {}
MockBluetoothAdapterClient::~MockBluetoothAdapterClient() {}
} // namespace chromeos
// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_MOCK_BLUETOOTH_ADAPTER_CLIENT_H_
#define CHROME_BROWSER_CHROMEOS_DBUS_MOCK_BLUETOOTH_ADAPTER_CLIENT_H_
#include <string>
#include "chrome/browser/chromeos/dbus/bluetooth_adapter_client.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class MockBluetoothAdapterClient : public BluetoothAdapterClient {
public:
MockBluetoothAdapterClient();
virtual ~MockBluetoothAdapterClient();
MOCK_METHOD2(AddObserver, void(Observer*, const std::string&));
MOCK_METHOD2(RemoveObserver, void(Observer*, const std::string&));
MOCK_METHOD1(StartDiscovery, void(const std::string&));
MOCK_METHOD1(StopDiscovery, void(const std::string&));
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_DBUS_MOCK_BLUETOOTH_ADAPTER_CLIENT_H_
// Copyright (c) 2011 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 "chrome/browser/chromeos/dbus/mock_bluetooth_manager_client.h"
namespace chromeos {
MockBluetoothManagerClient::MockBluetoothManagerClient() {}
MockBluetoothManagerClient::~MockBluetoothManagerClient() {}
} // namespace chromeos
// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_MOCK_BLUETOOTH_MANAGER_CLIENT_H_
#define CHROME_BROWSER_CHROMEOS_DBUS_MOCK_BLUETOOTH_MANAGER_CLIENT_H_
#include <string>
#include "chrome/browser/chromeos/dbus/bluetooth_manager_client.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class MockBluetoothManagerClient : public BluetoothManagerClient {
public:
MockBluetoothManagerClient();
virtual ~MockBluetoothManagerClient();
MOCK_METHOD1(AddObserver, void(Observer*));
MOCK_METHOD1(RemoveObserver, void(Observer*));
MOCK_METHOD1(DefaultAdapter,
void(const DefaultAdapterCallback& callback));
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_DBUS_MOCK_BLUETOOTH_MANAGER_CLIENT_H_
// Copyright (c) 2011 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 "chrome/browser/chromeos/dbus/mock_dbus_thread_manager.h"
#include "chrome/browser/chromeos/dbus/mock_bluetooth_adapter_client.h"
#include "chrome/browser/chromeos/dbus/mock_bluetooth_manager_client.h"
#include "chrome/browser/chromeos/dbus/mock_power_manager_client.h"
#include "chrome/browser/chromeos/dbus/mock_sensors_client.h"
#include "chrome/browser/chromeos/dbus/mock_session_manager_client.h"
#include "chrome/browser/chromeos/dbus/mock_speech_synthesizer_client.h"
using ::testing::Return;
namespace chromeos {
MockDBusThreadManager::MockDBusThreadManager()
: mock_bluetooth_adapter_client_(new MockBluetoothAdapterClient),
mock_bluetooth_manager_client_(new MockBluetoothManagerClient),
mock_power_manager_client_(new MockPowerManagerClient),
mock_sensors_client_(new MockSensorsClient),
mock_session_manager_client_(new MockSessionManagerClient),
mock_speech_synthesizer_client_(new MockSpeechSynthesizerClient) {
EXPECT_CALL(*this, bluetooth_adapter_client())
.WillRepeatedly(Return(mock_bluetooth_adapter_client_.get()));
EXPECT_CALL(*this, bluetooth_manager_client())
.WillRepeatedly(Return(mock_bluetooth_manager_client()));
EXPECT_CALL(*this, power_manager_client())
.WillRepeatedly(Return(mock_power_manager_client_.get()));
EXPECT_CALL(*this, sensors_client())
.WillRepeatedly(Return(mock_sensors_client_.get()));
EXPECT_CALL(*this, session_manager_client())
.WillRepeatedly(Return(mock_session_manager_client_.get()));
EXPECT_CALL(*this, speech_synthesizer_client())
.WillRepeatedly(Return(mock_speech_synthesizer_client_.get()));
}
MockDBusThreadManager::~MockDBusThreadManager() {}
} // namespace chromeos
// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_
#define CHROME_BROWSER_CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_
#include <string>
#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class MockBluetoothManagerClient;
class MockBluetoothAdapterClient;
class MockPowerManagerClient;
class MockSensorsClient;
class MockSessionManagerClient;
class MockSpeechSynthesizerClient;
// This class provides a mock DBusThreadManager with mock clients
// installed. You can customize the behaviors of mock clients with
// mock_foo_client() functions.
class MockDBusThreadManager : public DBusThreadManager {
public:
MockDBusThreadManager();
virtual ~MockDBusThreadManager();
MOCK_METHOD0(bluetooth_adapter_client, BluetoothAdapterClient*(void));
MOCK_METHOD0(bluetooth_manager_client, BluetoothManagerClient*(void));
MOCK_METHOD0(power_manager_client, PowerManagerClient*(void));
MOCK_METHOD0(sensors_client, SensorsClient*(void));
MOCK_METHOD0(session_manager_client, SessionManagerClient*(void));
MOCK_METHOD1(set_session_manager_client_for_testing,
void(SessionManagerClient*));
MOCK_METHOD0(speech_synthesizer_client, SpeechSynthesizerClient*(void));
MockBluetoothAdapterClient* mock_bluetooth_adapter_client() {
return mock_bluetooth_adapter_client_.get();
}
MockBluetoothManagerClient* mock_bluetooth_manager_client() {
return mock_bluetooth_manager_client_.get();
}
MockPowerManagerClient* mock_power_manager_client() {
return mock_power_manager_client_.get();
}
MockSensorsClient* mock_sensors_client() {
return mock_sensors_client_.get();
}
MockSessionManagerClient* mock_session_manager_client() {
return mock_session_manager_client_.get();
}
MockSpeechSynthesizerClient* mock_speech_synthesizer_client() {
return mock_speech_synthesizer_client_.get();
}
private:
scoped_ptr<MockBluetoothAdapterClient> mock_bluetooth_adapter_client_;
scoped_ptr<MockBluetoothManagerClient> mock_bluetooth_manager_client_;
scoped_ptr<MockPowerManagerClient> mock_power_manager_client_;
scoped_ptr<MockSensorsClient> mock_sensors_client_;
scoped_ptr<MockSessionManagerClient> mock_session_manager_client_;
scoped_ptr<MockSpeechSynthesizerClient> mock_speech_synthesizer_client_;
DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManager);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_
// Copyright (c) 2011 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 "chrome/browser/chromeos/dbus/mock_power_manager_client.h"
namespace chromeos {
MockPowerManagerClient::MockPowerManagerClient() {}
MockPowerManagerClient::~MockPowerManagerClient() {}
} // namespace chromeos
// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_MOCK_POWER_MANAGER_CLIENT_H_
#define CHROME_BROWSER_CHROMEOS_DBUS_MOCK_POWER_MANAGER_CLIENT_H_
#include <string>
#include "chrome/browser/chromeos/dbus/power_manager_client.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class MockPowerManagerClient : public PowerManagerClient {
public:
MockPowerManagerClient();
virtual ~MockPowerManagerClient();
MOCK_METHOD1(AddObserver, void(Observer*));
MOCK_METHOD1(RemoveObserver, void(Observer*));
MOCK_METHOD1(DecreaseScreenBrightness, void(bool));
MOCK_METHOD0(IncreaseScreenBrightness, void(void));
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_DBUS_MOCK_POWER_MANAGER_CLIENT_H_
// Copyright (c) 2011 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 "chrome/browser/chromeos/dbus/mock_sensors_client.h"
namespace chromeos {
MockSensorsClient::MockSensorsClient() {}
MockSensorsClient::~MockSensorsClient() {}
} // namespace chromeos
// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_MOCK_SENSORS_CLIENT_H_
#define CHROME_BROWSER_CHROMEOS_DBUS_MOCK_SENSORS_CLIENT_H_
#include <string>
#include "chrome/browser/chromeos/dbus/sensors_client.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class MockSensorsClient : public SensorsClient {
public:
MockSensorsClient();
virtual ~MockSensorsClient();
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_DBUS_MOCK_SENSORS_CLIENT_H_
// Copyright (c) 2011 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 "chrome/browser/chromeos/dbus/mock_speech_synthesizer_client.h"
namespace chromeos {
MockSpeechSynthesizerClient::MockSpeechSynthesizerClient() {}
MockSpeechSynthesizerClient::~MockSpeechSynthesizerClient() {}
} // namespace chromeos
// Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_MOCK_SPEECH_SYNTHESIZER_CLIENT_H_
#define CHROME_BROWSER_CHROMEOS_DBUS_MOCK_SPEECH_SYNTHESIZER_CLIENT_H_
#include <string>
#include "chrome/browser/chromeos/dbus/speech_synthesizer_client.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class MockSpeechSynthesizerClient : public SpeechSynthesizerClient {
public:
MockSpeechSynthesizerClient();
virtual ~MockSpeechSynthesizerClient();
MOCK_METHOD1(Speak, void(const std::string&));
MOCK_METHOD1(SetSpeakProperties, void(const std::string&));
MOCK_METHOD0(StopSpeaking, void());
MOCK_METHOD1(IsSpeaking, void(IsSpeakingCallback));
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_DBUS_MOCK_SPEECH_SYNTHESIZER_CLIENT_H_
...@@ -89,8 +89,20 @@ ...@@ -89,8 +89,20 @@
'browser/chromeos/cros/mock_library_loader.h', 'browser/chromeos/cros/mock_library_loader.h',
'browser/chromeos/cros/mock_network_library.cc', 'browser/chromeos/cros/mock_network_library.cc',
'browser/chromeos/cros/mock_network_library.h', 'browser/chromeos/cros/mock_network_library.h',
'browser/chromeos/dbus/mock_bluetooth_adapter_client.cc',
'browser/chromeos/dbus/mock_bluetooth_adapter_client.h',
'browser/chromeos/dbus/mock_bluetooth_manager_client.cc',
'browser/chromeos/dbus/mock_bluetooth_manager_client.h',
'browser/chromeos/dbus/mock_dbus_thread_manager.cc',
'browser/chromeos/dbus/mock_dbus_thread_manager.h',
'browser/chromeos/dbus/mock_power_manager_client.cc',
'browser/chromeos/dbus/mock_power_manager_client.h',
'browser/chromeos/dbus/mock_sensors_client.cc',
'browser/chromeos/dbus/mock_sensors_client.h',
'browser/chromeos/dbus/mock_session_manager_client.cc', 'browser/chromeos/dbus/mock_session_manager_client.cc',
'browser/chromeos/dbus/mock_session_manager_client.h', 'browser/chromeos/dbus/mock_session_manager_client.h',
'browser/chromeos/dbus/mock_speech_synthesizer_client.cc',
'browser/chromeos/dbus/mock_speech_synthesizer_client.h',
'browser/chromeos/login/mock_signed_settings_helper.cc', 'browser/chromeos/login/mock_signed_settings_helper.cc',
'browser/chromeos/login/mock_signed_settings_helper.h', 'browser/chromeos/login/mock_signed_settings_helper.h',
# The only thing used from browser is Browser::Type. # The only thing used from browser is Browser::Type.
......
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