OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "chromeos/dbus/bluetooth_profile_service_provider.h" | 7 #include "chromeos/dbus/bluetooth_profile_service_provider.h" |
8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
11 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 11 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | 12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
13 #include "device/bluetooth/bluetooth_adapter.h" | 13 #include "device/bluetooth/bluetooth_adapter.h" |
14 #include "device/bluetooth/bluetooth_adapter_chromeos.h" | 14 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
15 #include "device/bluetooth/bluetooth_adapter_factory.h" | 15 #include "device/bluetooth/bluetooth_adapter_factory.h" |
16 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h" | 16 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h" |
17 #include "device/bluetooth/bluetooth_uuid.h" | 17 #include "device/bluetooth/bluetooth_uuid.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using device::BluetoothAdapter; | 20 using device::BluetoothAdapter; |
21 using device::BluetoothUUID; | 21 using device::BluetoothUUID; |
22 | 22 |
23 namespace { | |
24 | |
25 void DoNothingDBusErrorCallback(const std::string& error_name, | |
26 const std::string& error_message) { | |
27 } | |
28 | |
29 } // namespace | |
30 | |
31 namespace chromeos { | 23 namespace chromeos { |
32 | 24 |
33 class BluetoothAdapterProfileChromeOSTest : public testing::Test { | 25 class BluetoothAdapterProfileChromeOSTest : public testing::Test { |
34 public: | 26 public: |
35 BluetoothAdapterProfileChromeOSTest() | 27 BluetoothAdapterProfileChromeOSTest() |
36 : fake_delegate_paired_(FakeBluetoothDeviceClient::kPairedDevicePath), | 28 : fake_delegate_paired_(FakeBluetoothDeviceClient::kPairedDevicePath), |
37 fake_delegate_autopair_(FakeBluetoothDeviceClient::kLegacyAutopairPath), | 29 fake_delegate_autopair_(FakeBluetoothDeviceClient::kLegacyAutopairPath), |
38 fake_delegate_listen_(""), | 30 fake_delegate_listen_(""), |
39 profile_(nullptr), | 31 profile_ptr_(nullptr), |
40 success_callback_count_(0), | 32 success_callback_count_(0), |
41 error_callback_count_(0) {} | 33 error_callback_count_(0) {} |
42 | 34 |
43 void SetUp() override { | 35 void SetUp() override { |
44 scoped_ptr<DBusThreadManagerSetter> dbus_setter = | 36 scoped_ptr<DBusThreadManagerSetter> dbus_setter = |
45 DBusThreadManager::GetSetterForTesting(); | 37 DBusThreadManager::GetSetterForTesting(); |
46 | 38 |
47 dbus_setter->SetBluetoothAdapterClient( | 39 dbus_setter->SetBluetoothAdapterClient( |
48 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); | 40 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); |
49 dbus_setter->SetBluetoothAgentManagerClient( | 41 dbus_setter->SetBluetoothAgentManagerClient( |
(...skipping 13 matching lines...) Expand all Loading... | |
63 ASSERT_TRUE(adapter_->IsInitialized()); | 55 ASSERT_TRUE(adapter_->IsInitialized()); |
64 ASSERT_TRUE(adapter_->IsPresent()); | 56 ASSERT_TRUE(adapter_->IsPresent()); |
65 | 57 |
66 // Turn on the adapter. | 58 // Turn on the adapter. |
67 adapter_->SetPowered(true, base::Bind(&base::DoNothing), | 59 adapter_->SetPowered(true, base::Bind(&base::DoNothing), |
68 base::Bind(&base::DoNothing)); | 60 base::Bind(&base::DoNothing)); |
69 ASSERT_TRUE(adapter_->IsPowered()); | 61 ASSERT_TRUE(adapter_->IsPowered()); |
70 } | 62 } |
71 | 63 |
72 void TearDown() override { | 64 void TearDown() override { |
65 profile_.reset(); | |
73 adapter_ = nullptr; | 66 adapter_ = nullptr; |
74 DBusThreadManager::Shutdown(); | 67 DBusThreadManager::Shutdown(); |
75 } | 68 } |
76 | 69 |
77 void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { | 70 void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { |
78 adapter_ = adapter; | 71 adapter_ = adapter; |
79 } | 72 } |
80 | 73 |
81 class FakeDelegate | 74 class FakeDelegate |
82 : public chromeos::BluetoothProfileServiceProvider::Delegate { | 75 : public chromeos::BluetoothProfileServiceProvider::Delegate { |
(...skipping 12 matching lines...) Expand all Loading... | |
95 scoped_ptr<dbus::FileDescriptor> fd, | 88 scoped_ptr<dbus::FileDescriptor> fd, |
96 const BluetoothProfileServiceProvider::Delegate::Options& options, | 89 const BluetoothProfileServiceProvider::Delegate::Options& options, |
97 const ConfirmationCallback& callback) override { | 90 const ConfirmationCallback& callback) override { |
98 VLOG(1) << "connection for " << device_path.value() << " on " | 91 VLOG(1) << "connection for " << device_path.value() << " on " |
99 << device_path_.value(); | 92 << device_path_.value(); |
100 ++connections_; | 93 ++connections_; |
101 fd->CheckValidity(); | 94 fd->CheckValidity(); |
102 close(fd->TakeValue()); | 95 close(fd->TakeValue()); |
103 callback.Run(SUCCESS); | 96 callback.Run(SUCCESS); |
104 if (device_path_.value() != "") | 97 if (device_path_.value() != "") |
105 ASSERT_TRUE(device_path == device_path_); | 98 ASSERT_EQ(device_path_, device_path); |
106 } | 99 } |
107 | 100 |
108 void RequestDisconnection(const dbus::ObjectPath& device_path, | 101 void RequestDisconnection(const dbus::ObjectPath& device_path, |
109 const ConfirmationCallback& callback) override { | 102 const ConfirmationCallback& callback) override { |
110 VLOG(1) << "disconnect " << device_path.value(); | 103 VLOG(1) << "disconnect " << device_path.value(); |
111 ++disconnections_; | 104 ++disconnections_; |
112 } | 105 } |
113 | 106 |
114 void Cancel() override { | 107 void Cancel() override { |
115 VLOG(1) << "cancel"; | 108 VLOG(1) << "cancel"; |
116 // noop | 109 // noop |
117 } | 110 } |
118 | 111 |
119 unsigned int connections_; | 112 unsigned int connections_; |
120 unsigned int disconnections_; | 113 unsigned int disconnections_; |
121 dbus::ObjectPath device_path_; | 114 dbus::ObjectPath device_path_; |
122 }; | 115 }; |
123 | 116 |
124 FakeDelegate fake_delegate_paired_; | 117 FakeDelegate fake_delegate_paired_; |
125 FakeDelegate fake_delegate_autopair_; | 118 FakeDelegate fake_delegate_autopair_; |
126 FakeDelegate fake_delegate_listen_; | 119 FakeDelegate fake_delegate_listen_; |
127 | 120 |
128 BluetoothAdapterProfileChromeOS* profile_; | 121 scoped_ptr<BluetoothAdapterProfileChromeOS> profile_; |
122 | |
123 void ProfileSuccessCallback( | |
124 scoped_ptr<BluetoothAdapterProfileChromeOS> profile) { | |
125 profile_.swap(profile); | |
126 ++success_callback_count_; | |
127 } | |
128 | |
129 BluetoothAdapterProfileChromeOS* profile_ptr_; | |
Ilya Sherman
2015/03/05 04:33:54
It's kind of confusing to have both profile_ and p
Ilya Sherman
2015/03/05 04:33:54
FWIW, it's also surprising to me that this test cl
Marie Janssen
2015/03/09 16:22:49
Done.
| |
130 | |
131 void ProfileUserSuccessCallback(BluetoothAdapterProfileChromeOS* profile) { | |
132 profile_ptr_ = profile; | |
133 ++success_callback_count_; | |
134 } | |
135 | |
136 void MatchedProfileCallback(BluetoothAdapterProfileChromeOS* profile) { | |
137 VLOG(1) << "Matched Profile Callback"; | |
138 ASSERT_EQ(profile_ptr_, profile); | |
139 ++success_callback_count_; | |
140 } | |
129 | 141 |
130 void DBusConnectSuccessCallback() { ++success_callback_count_; } | 142 void DBusConnectSuccessCallback() { ++success_callback_count_; } |
131 | 143 |
132 void DBusErrorCallback(const std::string& error_name, | 144 void DBusErrorCallback(const std::string& error_name, |
133 const std::string& error_message) { | 145 const std::string& error_message) { |
134 VLOG(1) << "DBus Connect Error: " << error_name << " - " << error_message; | 146 VLOG(1) << "DBus Connect Error: " << error_name << " - " << error_message; |
135 ++error_callback_count_; | 147 ++error_callback_count_; |
136 } | 148 } |
137 | 149 |
150 void BasicErrorCallback(const std::string& error_message) { | |
151 VLOG(1) << "Error: " << error_message; | |
152 ++error_callback_count_; | |
153 } | |
154 | |
138 protected: | 155 protected: |
139 base::MessageLoop message_loop_; | 156 base::MessageLoop message_loop_; |
140 | 157 |
141 scoped_refptr<BluetoothAdapter> adapter_; | 158 scoped_refptr<BluetoothAdapter> adapter_; |
142 | 159 |
143 unsigned int success_callback_count_; | 160 unsigned int success_callback_count_; |
144 unsigned int error_callback_count_; | 161 unsigned int error_callback_count_; |
145 }; | 162 }; |
146 | 163 |
147 TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) { | 164 TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) { |
148 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | 165 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); |
149 BluetoothProfileManagerClient::Options options; | 166 BluetoothProfileManagerClient::Options options; |
150 | 167 |
151 options.require_authentication.reset(new bool(false)); | 168 options.require_authentication.reset(new bool(false)); |
152 | 169 |
153 profile_ = BluetoothAdapterProfileChromeOS::Register( | 170 BluetoothAdapterProfileChromeOS::Register( |
154 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()), uuid, options, | 171 uuid, options, |
155 base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback)); | 172 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, |
173 base::Unretained(this)), | |
174 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | |
175 base::Unretained(this))); | |
156 | 176 |
157 message_loop_.RunUntilIdle(); | 177 message_loop_.RunUntilIdle(); |
158 | 178 |
159 EXPECT_TRUE(profile_); | 179 EXPECT_TRUE(profile_); |
180 EXPECT_EQ(1U, success_callback_count_); | |
181 EXPECT_EQ(0U, error_callback_count_); | |
160 | 182 |
161 EXPECT_EQ(0U, profile_->DelegateCount()); | 183 EXPECT_EQ(0U, profile_->DelegateCount()); |
162 | 184 |
163 profile_->SetDelegate(fake_delegate_paired_.device_path_, | 185 profile_->SetDelegate(fake_delegate_paired_.device_path_, |
164 &fake_delegate_paired_); | 186 &fake_delegate_paired_); |
165 | 187 |
166 EXPECT_EQ(1U, profile_->DelegateCount()); | 188 EXPECT_EQ(1U, profile_->DelegateCount()); |
167 | 189 |
168 profile_->RemoveDelegate(fake_delegate_autopair_.device_path_, | 190 profile_->RemoveDelegate(fake_delegate_autopair_.device_path_, |
169 base::Bind(&base::DoNothing)); | 191 base::Bind(&base::DoNothing)); |
170 | 192 |
171 EXPECT_EQ(1U, profile_->DelegateCount()); | 193 EXPECT_EQ(1U, profile_->DelegateCount()); |
172 | 194 |
173 profile_->RemoveDelegate(fake_delegate_paired_.device_path_, | 195 profile_->RemoveDelegate(fake_delegate_paired_.device_path_, |
174 base::Bind(&base::DoNothing)); | 196 base::Bind(&base::DoNothing)); |
175 | 197 |
176 EXPECT_EQ(0U, profile_->DelegateCount()); | 198 EXPECT_EQ(0U, profile_->DelegateCount()); |
177 | |
178 delete profile_; | |
179 }; | 199 }; |
180 | 200 |
181 TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) { | 201 TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) { |
182 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | 202 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); |
183 BluetoothProfileManagerClient::Options options; | 203 BluetoothProfileManagerClient::Options options; |
184 | 204 |
185 options.require_authentication.reset(new bool(false)); | 205 options.require_authentication.reset(new bool(false)); |
186 | 206 |
187 profile_ = BluetoothAdapterProfileChromeOS::Register( | 207 BluetoothAdapterProfileChromeOS::Register( |
188 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()), uuid, options, | 208 uuid, options, |
189 base::Bind( | 209 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, |
190 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, | 210 base::Unretained(this)), |
191 base::Unretained(this)), | |
192 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 211 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
193 base::Unretained(this))); | 212 base::Unretained(this))); |
194 | 213 |
195 message_loop_.RunUntilIdle(); | 214 message_loop_.RunUntilIdle(); |
196 | 215 |
197 EXPECT_TRUE(profile_); | 216 EXPECT_TRUE(profile_); |
198 EXPECT_EQ(1U, success_callback_count_); | 217 EXPECT_EQ(1U, success_callback_count_); |
199 EXPECT_EQ(0U, error_callback_count_); | 218 EXPECT_EQ(0U, error_callback_count_); |
200 | 219 |
201 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( | 220 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( |
202 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), | 221 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), |
203 FakeBluetoothProfileManagerClient::kRfcommUuid, | 222 FakeBluetoothProfileManagerClient::kRfcommUuid, |
204 base::Bind( | 223 base::Bind( |
205 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, | 224 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, |
206 base::Unretained(this)), | 225 base::Unretained(this)), |
207 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 226 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
208 base::Unretained(this))); | 227 base::Unretained(this))); |
209 | 228 |
210 message_loop_.RunUntilIdle(); | 229 message_loop_.RunUntilIdle(); |
211 | 230 |
212 EXPECT_EQ(1U, success_callback_count_); | 231 EXPECT_EQ(1U, success_callback_count_); |
213 EXPECT_EQ(1U, error_callback_count_); | 232 EXPECT_EQ(1U, error_callback_count_); |
214 | 233 |
215 EXPECT_EQ(0U, fake_delegate_paired_.connections_); | 234 EXPECT_EQ(0U, fake_delegate_paired_.connections_); |
216 | |
217 delete profile_; | |
218 }; | 235 }; |
219 | 236 |
220 TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { | 237 TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { |
221 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | 238 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); |
222 BluetoothProfileManagerClient::Options options; | 239 BluetoothProfileManagerClient::Options options; |
223 | 240 |
224 options.require_authentication.reset(new bool(false)); | 241 options.require_authentication.reset(new bool(false)); |
225 | 242 |
226 profile_ = BluetoothAdapterProfileChromeOS::Register( | 243 BluetoothAdapterProfileChromeOS::Register( |
227 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()), uuid, options, | 244 uuid, options, |
228 base::Bind( | 245 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, |
229 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, | 246 base::Unretained(this)), |
230 base::Unretained(this)), | |
231 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 247 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
232 base::Unretained(this))); | 248 base::Unretained(this))); |
233 | 249 |
234 message_loop_.RunUntilIdle(); | 250 message_loop_.RunUntilIdle(); |
235 | 251 |
236 ASSERT_TRUE(profile_); | 252 ASSERT_TRUE(profile_); |
253 ASSERT_EQ(1U, success_callback_count_); | |
254 ASSERT_EQ(0U, error_callback_count_); | |
237 | 255 |
238 profile_->SetDelegate(fake_delegate_paired_.device_path_, | 256 profile_->SetDelegate(fake_delegate_paired_.device_path_, |
239 &fake_delegate_paired_); | 257 &fake_delegate_paired_); |
240 profile_->SetDelegate(fake_delegate_autopair_.device_path_, | 258 profile_->SetDelegate(fake_delegate_autopair_.device_path_, |
241 &fake_delegate_autopair_); | 259 &fake_delegate_autopair_); |
242 profile_->SetDelegate(fake_delegate_listen_.device_path_, | 260 profile_->SetDelegate(fake_delegate_listen_.device_path_, |
243 &fake_delegate_listen_); | 261 &fake_delegate_listen_); |
244 | 262 |
245 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( | 263 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( |
246 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), | 264 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 base::Unretained(this)), | 301 base::Unretained(this)), |
284 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 302 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
285 base::Unretained(this))); | 303 base::Unretained(this))); |
286 | 304 |
287 message_loop_.RunUntilIdle(); | 305 message_loop_.RunUntilIdle(); |
288 | 306 |
289 EXPECT_EQ(4U, success_callback_count_); | 307 EXPECT_EQ(4U, success_callback_count_); |
290 EXPECT_EQ(0U, error_callback_count_); | 308 EXPECT_EQ(0U, error_callback_count_); |
291 | 309 |
292 EXPECT_EQ(1U, fake_delegate_listen_.connections_); | 310 EXPECT_EQ(1U, fake_delegate_listen_.connections_); |
311 }; | |
293 | 312 |
294 delete profile_; | 313 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) { |
314 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | |
315 BluetoothProfileManagerClient::Options options; | |
316 BluetoothAdapterChromeOS* adapter = | |
317 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()); | |
318 | |
319 options.require_authentication.reset(new bool(false)); | |
320 | |
321 success_callback_count_ = 0; | |
322 error_callback_count_ = 0; | |
323 | |
324 adapter->UseProfile( | |
325 uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_, | |
326 base::Bind( | |
327 &BluetoothAdapterProfileChromeOSTest::ProfileUserSuccessCallback, | |
328 base::Unretained(this)), | |
329 base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback, | |
330 base::Unretained(this))); | |
331 | |
332 adapter->UseProfile( | |
333 uuid, fake_delegate_autopair_.device_path_, options, | |
334 &fake_delegate_autopair_, | |
335 base::Bind(&BluetoothAdapterProfileChromeOSTest::MatchedProfileCallback, | |
336 base::Unretained(this)), | |
337 base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback, | |
338 base::Unretained(this))); | |
339 | |
340 message_loop_.RunUntilIdle(); | |
341 | |
342 EXPECT_TRUE(profile_ptr_); | |
343 EXPECT_EQ(2U, success_callback_count_); | |
344 EXPECT_EQ(0U, error_callback_count_); | |
345 | |
346 adapter->ReleaseProfile(fake_delegate_paired_.device_path_, profile_ptr_); | |
347 adapter->ReleaseProfile(fake_delegate_autopair_.device_path_, profile_ptr_); | |
348 | |
349 message_loop_.RunUntilIdle(); | |
350 }; | |
351 | |
352 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) { | |
353 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kUnregisterableUuid); | |
354 BluetoothProfileManagerClient::Options options; | |
355 BluetoothAdapterChromeOS* adapter = | |
356 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()); | |
357 | |
358 options.require_authentication.reset(new bool(false)); | |
359 | |
360 success_callback_count_ = 0; | |
361 error_callback_count_ = 0; | |
362 | |
363 adapter->UseProfile( | |
364 uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_, | |
365 base::Bind( | |
366 &BluetoothAdapterProfileChromeOSTest::ProfileUserSuccessCallback, | |
367 base::Unretained(this)), | |
368 base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback, | |
369 base::Unretained(this))); | |
370 | |
371 adapter->UseProfile( | |
372 uuid, fake_delegate_autopair_.device_path_, options, | |
373 &fake_delegate_autopair_, | |
374 base::Bind(&BluetoothAdapterProfileChromeOSTest::MatchedProfileCallback, | |
375 base::Unretained(this)), | |
376 base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback, | |
377 base::Unretained(this))); | |
378 | |
379 message_loop_.RunUntilIdle(); | |
380 | |
381 EXPECT_FALSE(profile_ptr_); | |
382 EXPECT_EQ(0U, success_callback_count_); | |
383 EXPECT_EQ(2U, error_callback_count_); | |
295 }; | 384 }; |
296 | 385 |
297 } // namespace chromeos | 386 } // namespace chromeos |
OLD | NEW |