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

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

Issue 49773003: ChromeOS: Remove MockDBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests. Created 7 years, 1 month 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
« no previous file with comments | « device/bluetooth/bluetooth_chromeos_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
6 #include "chromeos/dbus/fake_bluetooth_device_client.h" 7 #include "chromeos/dbus/fake_bluetooth_device_client.h"
8 #include "chromeos/dbus/fake_bluetooth_input_client.h"
7 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" 9 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
8 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" 10 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
9 #include "chromeos/dbus/fake_dbus_thread_manager.h" 11 #include "chromeos/dbus/fake_dbus_thread_manager.h"
10 #include "device/bluetooth/bluetooth_adapter.h" 12 #include "device/bluetooth/bluetooth_adapter.h"
11 #include "device/bluetooth/bluetooth_adapter_chromeos.h" 13 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
12 #include "device/bluetooth/bluetooth_adapter_factory.h" 14 #include "device/bluetooth/bluetooth_adapter_factory.h"
13 #include "device/bluetooth/bluetooth_device.h" 15 #include "device/bluetooth/bluetooth_device.h"
14 #include "device/bluetooth/bluetooth_device_chromeos.h" 16 #include "device/bluetooth/bluetooth_device_chromeos.h"
15 #include "device/bluetooth/bluetooth_profile.h" 17 #include "device/bluetooth/bluetooth_profile.h"
16 #include "device/bluetooth/bluetooth_profile_chromeos.h" 18 #include "device/bluetooth/bluetooth_profile_chromeos.h"
(...skipping 14 matching lines...) Expand all
31 BluetoothProfileChromeOSTest() 33 BluetoothProfileChromeOSTest()
32 : message_loop_(base::MessageLoop::TYPE_IO), 34 : message_loop_(base::MessageLoop::TYPE_IO),
33 callback_count_(0), 35 callback_count_(0),
34 error_callback_count_(0), 36 error_callback_count_(0),
35 profile_callback_count_(0), 37 profile_callback_count_(0),
36 connection_callback_count_(0), 38 connection_callback_count_(0),
37 last_profile_(NULL), 39 last_profile_(NULL),
38 last_device_(NULL) {} 40 last_device_(NULL) {}
39 41
40 virtual void SetUp() { 42 virtual void SetUp() {
41 fake_dbus_thread_manager_ = new FakeDBusThreadManager(); 43 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager;
42 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager_);
43
44 fake_bluetooth_profile_manager_client_ = 44 fake_bluetooth_profile_manager_client_ =
45 fake_dbus_thread_manager_->fake_bluetooth_profile_manager_client(); 45 new FakeBluetoothProfileManagerClient;
46 fake_dbus_thread_manager->SetBluetoothProfileManagerClient(
47 scoped_ptr<BluetoothProfileManagerClient>(
48 fake_bluetooth_profile_manager_client_));
49 fake_dbus_thread_manager->SetBluetoothAdapterClient(
50 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
51 fake_dbus_thread_manager->SetBluetoothDeviceClient(
52 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
53 fake_dbus_thread_manager->SetBluetoothInputClient(
54 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
55 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager);
46 56
47 device::BluetoothAdapterFactory::GetAdapter( 57 device::BluetoothAdapterFactory::GetAdapter(
48 base::Bind(&BluetoothProfileChromeOSTest::AdapterCallback, 58 base::Bind(&BluetoothProfileChromeOSTest::AdapterCallback,
49 base::Unretained(this))); 59 base::Unretained(this)));
50 ASSERT_TRUE(adapter_.get() != NULL); 60 ASSERT_TRUE(adapter_.get() != NULL);
51 ASSERT_TRUE(adapter_->IsInitialized()); 61 ASSERT_TRUE(adapter_->IsInitialized());
52 ASSERT_TRUE(adapter_->IsPresent()); 62 ASSERT_TRUE(adapter_->IsPresent());
53 63
54 adapter_->SetPowered( 64 adapter_->SetPowered(
55 true, 65 true,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 last_device_ = device; 98 last_device_ = device;
89 last_socket_ = socket; 99 last_socket_ = socket;
90 100
91 message_loop_.Quit(); 101 message_loop_.Quit();
92 } 102 }
93 103
94 protected: 104 protected:
95 base::MessageLoop message_loop_; 105 base::MessageLoop message_loop_;
96 106
97 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client_; 107 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client_;
98 FakeDBusThreadManager* fake_dbus_thread_manager_;
99 scoped_refptr<BluetoothAdapter> adapter_; 108 scoped_refptr<BluetoothAdapter> adapter_;
100 109
101 unsigned int callback_count_; 110 unsigned int callback_count_;
102 unsigned int error_callback_count_; 111 unsigned int error_callback_count_;
103 unsigned int profile_callback_count_; 112 unsigned int profile_callback_count_;
104 unsigned int connection_callback_count_; 113 unsigned int connection_callback_count_;
105 BluetoothProfile* last_profile_; 114 BluetoothProfile* last_profile_;
106 const BluetoothDevice* last_device_; 115 const BluetoothDevice* last_device_;
107 scoped_refptr<BluetoothSocket> last_socket_; 116 scoped_refptr<BluetoothSocket> last_socket_;
108 }; 117 };
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Unregister the profile, make sure it's no longer registered. 360 // Unregister the profile, make sure it's no longer registered.
352 last_profile_->Unregister(); 361 last_profile_->Unregister();
353 362
354 profile_service_provider = 363 profile_service_provider =
355 fake_bluetooth_profile_manager_client_->GetProfileServiceProvider( 364 fake_bluetooth_profile_manager_client_->GetProfileServiceProvider(
356 FakeBluetoothProfileManagerClient::kRfcommUuid); 365 FakeBluetoothProfileManagerClient::kRfcommUuid);
357 EXPECT_TRUE(profile_service_provider == NULL); 366 EXPECT_TRUE(profile_service_provider == NULL);
358 } 367 }
359 368
360 } // namespace chromeos 369 } // namespace chromeos
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_chromeos_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698