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

Side by Side Diff: device/bluetooth/bluetooth_gatt_chromeos_unittest.cc

Issue 477663004: Merged FakedDBusThreadManager with DBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "base/memory/scoped_vector.h" 5 #include "base/memory/scoped_vector.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" 9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" 10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
10 #include "chromeos/dbus/fake_bluetooth_device_client.h" 11 #include "chromeos/dbus/fake_bluetooth_device_client.h"
11 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" 12 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
12 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" 13 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
13 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" 14 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
14 #include "chromeos/dbus/fake_bluetooth_input_client.h" 15 #include "chromeos/dbus/fake_bluetooth_input_client.h"
15 #include "chromeos/dbus/fake_dbus_thread_manager.h"
16 #include "dbus/object_path.h" 16 #include "dbus/object_path.h"
17 #include "device/bluetooth/bluetooth_adapter.h" 17 #include "device/bluetooth/bluetooth_adapter.h"
18 #include "device/bluetooth/bluetooth_adapter_factory.h" 18 #include "device/bluetooth/bluetooth_adapter_factory.h"
19 #include "device/bluetooth/bluetooth_device.h" 19 #include "device/bluetooth/bluetooth_device.h"
20 #include "device/bluetooth/bluetooth_gatt_characteristic.h" 20 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
21 #include "device/bluetooth/bluetooth_gatt_connection.h" 21 #include "device/bluetooth/bluetooth_gatt_connection.h"
22 #include "device/bluetooth/bluetooth_gatt_descriptor.h" 22 #include "device/bluetooth/bluetooth_gatt_descriptor.h"
23 #include "device/bluetooth/bluetooth_gatt_notify_session.h" 23 #include "device/bluetooth/bluetooth_gatt_notify_session.h"
24 #include "device/bluetooth/bluetooth_gatt_service.h" 24 #include "device/bluetooth/bluetooth_gatt_service.h"
25 #include "device/bluetooth/bluetooth_uuid.h" 25 #include "device/bluetooth/bluetooth_uuid.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 class BluetoothGattChromeOSTest : public testing::Test { 275 class BluetoothGattChromeOSTest : public testing::Test {
276 public: 276 public:
277 BluetoothGattChromeOSTest() 277 BluetoothGattChromeOSTest()
278 : fake_bluetooth_gatt_service_client_(NULL), 278 : fake_bluetooth_gatt_service_client_(NULL),
279 success_callback_count_(0), 279 success_callback_count_(0),
280 error_callback_count_(0) { 280 error_callback_count_(0) {
281 } 281 }
282 282
283 virtual void SetUp() { 283 virtual void SetUp() {
284 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; 284 scoped_ptr<DBusThreadManagerSetter> dbus_setter =
285 chromeos::DBusThreadManager::GetSetterForTesting();
285 fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; 286 fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient;
286 fake_bluetooth_gatt_service_client_ = 287 fake_bluetooth_gatt_service_client_ =
287 new FakeBluetoothGattServiceClient; 288 new FakeBluetoothGattServiceClient;
288 fake_bluetooth_gatt_characteristic_client_ = 289 fake_bluetooth_gatt_characteristic_client_ =
289 new FakeBluetoothGattCharacteristicClient; 290 new FakeBluetoothGattCharacteristicClient;
290 fake_bluetooth_gatt_descriptor_client_ = 291 fake_bluetooth_gatt_descriptor_client_ =
291 new FakeBluetoothGattDescriptorClient; 292 new FakeBluetoothGattDescriptorClient;
292 fake_dbus_thread_manager->SetBluetoothDeviceClient( 293 dbus_setter->SetBluetoothDeviceClient(
293 scoped_ptr<BluetoothDeviceClient>( 294 scoped_ptr<BluetoothDeviceClient>(
294 fake_bluetooth_device_client_)); 295 fake_bluetooth_device_client_));
295 fake_dbus_thread_manager->SetBluetoothGattServiceClient( 296 dbus_setter->SetBluetoothGattServiceClient(
296 scoped_ptr<BluetoothGattServiceClient>( 297 scoped_ptr<BluetoothGattServiceClient>(
297 fake_bluetooth_gatt_service_client_)); 298 fake_bluetooth_gatt_service_client_));
298 fake_dbus_thread_manager->SetBluetoothGattCharacteristicClient( 299 dbus_setter->SetBluetoothGattCharacteristicClient(
299 scoped_ptr<BluetoothGattCharacteristicClient>( 300 scoped_ptr<BluetoothGattCharacteristicClient>(
300 fake_bluetooth_gatt_characteristic_client_)); 301 fake_bluetooth_gatt_characteristic_client_));
301 fake_dbus_thread_manager->SetBluetoothGattDescriptorClient( 302 dbus_setter->SetBluetoothGattDescriptorClient(
302 scoped_ptr<BluetoothGattDescriptorClient>( 303 scoped_ptr<BluetoothGattDescriptorClient>(
303 fake_bluetooth_gatt_descriptor_client_)); 304 fake_bluetooth_gatt_descriptor_client_));
304 fake_dbus_thread_manager->SetBluetoothAdapterClient( 305 dbus_setter->SetBluetoothAdapterClient(
305 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); 306 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
306 fake_dbus_thread_manager->SetBluetoothInputClient( 307 dbus_setter->SetBluetoothInputClient(
307 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); 308 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
308 fake_dbus_thread_manager->SetBluetoothAgentManagerClient( 309 dbus_setter->SetBluetoothAgentManagerClient(
309 scoped_ptr<BluetoothAgentManagerClient>( 310 scoped_ptr<BluetoothAgentManagerClient>(
310 new FakeBluetoothAgentManagerClient)); 311 new FakeBluetoothAgentManagerClient));
311 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager);
312 312
313 GetAdapter(); 313 GetAdapter();
314 314
315 adapter_->SetPowered( 315 adapter_->SetPowered(
316 true, 316 true,
317 base::Bind(&base::DoNothing), 317 base::Bind(&base::DoNothing),
318 base::Bind(&base::DoNothing)); 318 base::Bind(&base::DoNothing));
319 ASSERT_TRUE(adapter_->IsPowered()); 319 ASSERT_TRUE(adapter_->IsPowered());
320 } 320 }
321 321
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 1311
1312 EXPECT_EQ(1, success_callback_count_); 1312 EXPECT_EQ(1, success_callback_count_);
1313 EXPECT_EQ(0, error_callback_count_); 1313 EXPECT_EQ(0, error_callback_count_);
1314 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count_); 1314 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count_);
1315 EXPECT_TRUE(characteristic->IsNotifying()); 1315 EXPECT_TRUE(characteristic->IsNotifying());
1316 EXPECT_EQ(1U, update_sessions_.size()); 1316 EXPECT_EQ(1U, update_sessions_.size());
1317 EXPECT_TRUE(update_sessions_[0]->IsActive()); 1317 EXPECT_TRUE(update_sessions_[0]->IsActive());
1318 } 1318 }
1319 1319
1320 } // namespace chromeos 1320 } // namespace chromeos
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_chromeos_unittest.cc ('k') | device/bluetooth/bluetooth_socket_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698