OLD | NEW |
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_adapter_client.h" |
7 #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" | 8 #include "chromeos/dbus/fake_bluetooth_input_client.h" |
9 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
10 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" | 10 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 using device::BluetoothAdapter; | 24 using device::BluetoothAdapter; |
25 using device::BluetoothDevice; | 25 using device::BluetoothDevice; |
26 using device::BluetoothProfile; | 26 using device::BluetoothProfile; |
27 using device::BluetoothSocket; | 27 using device::BluetoothSocket; |
28 | 28 |
29 namespace chromeos { | 29 namespace chromeos { |
30 | 30 |
31 class BluetoothProfileChromeOSTest : public testing::Test { | 31 class BluetoothProfileChromeOSTest : public testing::Test { |
32 public: | 32 public: |
33 BluetoothProfileChromeOSTest() | 33 BluetoothProfileChromeOSTest() |
34 : message_loop_(base::MessageLoop::TYPE_IO), | 34 : callback_count_(0), |
35 callback_count_(0), | |
36 error_callback_count_(0), | 35 error_callback_count_(0), |
37 profile_callback_count_(0), | 36 profile_callback_count_(0), |
38 connection_callback_count_(0), | 37 connection_callback_count_(0), |
39 last_profile_(NULL), | 38 last_profile_(NULL), |
40 last_device_(NULL) {} | 39 last_device_(NULL) {} |
41 | 40 |
42 virtual void SetUp() { | 41 virtual void SetUp() { |
43 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; | 42 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; |
44 fake_bluetooth_profile_manager_client_ = | 43 fake_bluetooth_profile_manager_client_ = |
45 new FakeBluetoothProfileManagerClient; | 44 new FakeBluetoothProfileManagerClient; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void ConnectionCallback(const BluetoothDevice *device, | 94 void ConnectionCallback(const BluetoothDevice *device, |
96 scoped_refptr<BluetoothSocket> socket) { | 95 scoped_refptr<BluetoothSocket> socket) { |
97 ++connection_callback_count_; | 96 ++connection_callback_count_; |
98 last_device_ = device; | 97 last_device_ = device; |
99 last_socket_ = socket; | 98 last_socket_ = socket; |
100 | 99 |
101 message_loop_.Quit(); | 100 message_loop_.Quit(); |
102 } | 101 } |
103 | 102 |
104 protected: | 103 protected: |
105 base::MessageLoop message_loop_; | 104 base::MessageLoopForIO message_loop_; |
106 | 105 |
107 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client_; | 106 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client_; |
108 scoped_refptr<BluetoothAdapter> adapter_; | 107 scoped_refptr<BluetoothAdapter> adapter_; |
109 | 108 |
110 unsigned int callback_count_; | 109 unsigned int callback_count_; |
111 unsigned int error_callback_count_; | 110 unsigned int error_callback_count_; |
112 unsigned int profile_callback_count_; | 111 unsigned int profile_callback_count_; |
113 unsigned int connection_callback_count_; | 112 unsigned int connection_callback_count_; |
114 BluetoothProfile* last_profile_; | 113 BluetoothProfile* last_profile_; |
115 const BluetoothDevice* last_device_; | 114 const BluetoothDevice* last_device_; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // Unregister the profile, make sure it's no longer registered. | 359 // Unregister the profile, make sure it's no longer registered. |
361 last_profile_->Unregister(); | 360 last_profile_->Unregister(); |
362 | 361 |
363 profile_service_provider = | 362 profile_service_provider = |
364 fake_bluetooth_profile_manager_client_->GetProfileServiceProvider( | 363 fake_bluetooth_profile_manager_client_->GetProfileServiceProvider( |
365 FakeBluetoothProfileManagerClient::kRfcommUuid); | 364 FakeBluetoothProfileManagerClient::kRfcommUuid); |
366 EXPECT_TRUE(profile_service_provider == NULL); | 365 EXPECT_TRUE(profile_service_provider == NULL); |
367 } | 366 } |
368 | 367 |
369 } // namespace chromeos | 368 } // namespace chromeos |
OLD | NEW |