diff options
author | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-10 16:02:49 +0000 |
---|---|---|
committer | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-10 16:02:49 +0000 |
commit | 54652d823fd3498a8fa4a294adfb1e5068f24079 (patch) | |
tree | 3910548219aa193f1ab7b19447d3a082d0c0f0d1 /device | |
parent | f3b041e6e425002bc05e0cb729fb4d0b58292d5f (diff) | |
download | chromium_src-54652d823fd3498a8fa4a294adfb1e5068f24079.zip chromium_src-54652d823fd3498a8fa4a294adfb1e5068f24079.tar.gz chromium_src-54652d823fd3498a8fa4a294adfb1e5068f24079.tar.bz2 |
ChromeOS: Remove MockDBusThreadManager.
- Extends FakeDBusThreadManager about DBusClient setters.
- Removes default initialization of DBusClients from FakeDBusThreadManager.
- Replaces all occurrences of MockDBusThreadManager in tests by FakeDBusThreadManager.
- Every test now creates exactly the DBusClients that are required.
- Removes all references to Fake/Stub implementations from the DBusThreadManagerImpl used for production.
Depends on:
https://codereview.chromium.org/50243005/
BUG=275286
TBR=miket@chromium.org,mkwst@chromium.org,rtenneti@chromium.org
Review URL: https://codereview.chromium.org/49773003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234172 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth_chromeos_unittest.cc | 23 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_profile_chromeos_unittest.cc | 19 |
2 files changed, 29 insertions, 13 deletions
diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc index 3adaacb..dea1322 100644 --- a/device/bluetooth/bluetooth_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc @@ -5,7 +5,9 @@ #include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" #include "chromeos/dbus/fake_bluetooth_adapter_client.h" +#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" #include "chromeos/dbus/fake_bluetooth_device_client.h" +#include "chromeos/dbus/fake_bluetooth_input_client.h" #include "chromeos/dbus/fake_dbus_thread_manager.h" #include "dbus/object_path.h" #include "device/bluetooth/bluetooth_adapter.h" @@ -208,13 +210,19 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate { class BluetoothChromeOSTest : public testing::Test { public: virtual void SetUp() { - fake_dbus_thread_manager_ = new FakeDBusThreadManager(); - DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager_); - - fake_bluetooth_adapter_client_ = - fake_dbus_thread_manager_->fake_bluetooth_adapter_client(); - fake_bluetooth_device_client_ = - fake_dbus_thread_manager_->fake_bluetooth_device_client(); + FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; + fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient; + fake_dbus_thread_manager->SetBluetoothAdapterClient( + scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_)); + fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; + fake_dbus_thread_manager->SetBluetoothDeviceClient( + scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); + fake_dbus_thread_manager->SetBluetoothInputClient( + scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); + fake_dbus_thread_manager->SetBluetoothAgentManagerClient( + scoped_ptr<BluetoothAgentManagerClient>( + new FakeBluetoothAgentManagerClient)); + DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); callback_count_ = 0; error_callback_count_ = 0; @@ -312,7 +320,6 @@ class BluetoothChromeOSTest : public testing::Test { protected: FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_; FakeBluetoothDeviceClient* fake_bluetooth_device_client_; - FakeDBusThreadManager* fake_dbus_thread_manager_; scoped_refptr<BluetoothAdapter> adapter_; int callback_count_; diff --git a/device/bluetooth/bluetooth_profile_chromeos_unittest.cc b/device/bluetooth/bluetooth_profile_chromeos_unittest.cc index bd91b86..1792cda 100644 --- a/device/bluetooth/bluetooth_profile_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_profile_chromeos_unittest.cc @@ -3,7 +3,9 @@ // found in the LICENSE file. #include "base/message_loop/message_loop.h" +#include "chromeos/dbus/fake_bluetooth_adapter_client.h" #include "chromeos/dbus/fake_bluetooth_device_client.h" +#include "chromeos/dbus/fake_bluetooth_input_client.h" #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" #include "chromeos/dbus/fake_dbus_thread_manager.h" @@ -38,11 +40,19 @@ class BluetoothProfileChromeOSTest : public testing::Test { last_device_(NULL) {} virtual void SetUp() { - fake_dbus_thread_manager_ = new FakeDBusThreadManager(); - DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager_); - + FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; fake_bluetooth_profile_manager_client_ = - fake_dbus_thread_manager_->fake_bluetooth_profile_manager_client(); + new FakeBluetoothProfileManagerClient; + fake_dbus_thread_manager->SetBluetoothProfileManagerClient( + scoped_ptr<BluetoothProfileManagerClient>( + fake_bluetooth_profile_manager_client_)); + fake_dbus_thread_manager->SetBluetoothAdapterClient( + scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); + fake_dbus_thread_manager->SetBluetoothDeviceClient( + scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); + fake_dbus_thread_manager->SetBluetoothInputClient( + scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); + DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); device::BluetoothAdapterFactory::GetAdapter( base::Bind(&BluetoothProfileChromeOSTest::AdapterCallback, @@ -95,7 +105,6 @@ class BluetoothProfileChromeOSTest : public testing::Test { base::MessageLoop message_loop_; FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client_; - FakeDBusThreadManager* fake_dbus_thread_manager_; scoped_refptr<BluetoothAdapter> adapter_; unsigned int callback_count_; |