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

Side by Side Diff: device/bluetooth/test/test_bluetooth_adapter_observer.cc

Issue 1542163002: Switch to standard integer types in device/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 4 years, 12 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
OLDNEW
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 "device/bluetooth/test/test_bluetooth_adapter_observer.h" 5 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "device/bluetooth/bluetooth_gatt_characteristic.h" 8 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
9 #include "device/bluetooth/bluetooth_gatt_descriptor.h" 9 #include "device/bluetooth/bluetooth_gatt_descriptor.h"
10 #include "device/bluetooth/bluetooth_gatt_service.h" 10 #include "device/bluetooth/bluetooth_gatt_service.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 ASSERT_TRUE(descriptor->GetCharacteristic()); 270 ASSERT_TRUE(descriptor->GetCharacteristic());
271 EXPECT_FALSE( 271 EXPECT_FALSE(
272 descriptor->GetCharacteristic()->GetDescriptor(last_gatt_descriptor_id_)); 272 descriptor->GetCharacteristic()->GetDescriptor(last_gatt_descriptor_id_));
273 273
274 QuitMessageLoop(); 274 QuitMessageLoop();
275 } 275 }
276 276
277 void TestBluetoothAdapterObserver::GattCharacteristicValueChanged( 277 void TestBluetoothAdapterObserver::GattCharacteristicValueChanged(
278 BluetoothAdapter* adapter, 278 BluetoothAdapter* adapter,
279 BluetoothGattCharacteristic* characteristic, 279 BluetoothGattCharacteristic* characteristic,
280 const std::vector<uint8>& value) { 280 const std::vector<uint8_t>& value) {
281 ASSERT_EQ(adapter_.get(), adapter); 281 ASSERT_EQ(adapter_.get(), adapter);
282 282
283 ++gatt_characteristic_value_changed_count_; 283 ++gatt_characteristic_value_changed_count_;
284 last_gatt_characteristic_id_ = characteristic->GetIdentifier(); 284 last_gatt_characteristic_id_ = characteristic->GetIdentifier();
285 last_gatt_characteristic_uuid_ = characteristic->GetUUID(); 285 last_gatt_characteristic_uuid_ = characteristic->GetUUID();
286 last_changed_characteristic_value_ = value; 286 last_changed_characteristic_value_ = value;
287 287
288 ASSERT_TRUE(characteristic->GetService()); 288 ASSERT_TRUE(characteristic->GetService());
289 EXPECT_EQ(characteristic->GetService()->GetCharacteristic( 289 EXPECT_EQ(characteristic->GetService()->GetCharacteristic(
290 last_gatt_characteristic_id_), 290 last_gatt_characteristic_id_),
291 characteristic); 291 characteristic);
292 292
293 QuitMessageLoop(); 293 QuitMessageLoop();
294 } 294 }
295 295
296 void TestBluetoothAdapterObserver::GattDescriptorValueChanged( 296 void TestBluetoothAdapterObserver::GattDescriptorValueChanged(
297 BluetoothAdapter* adapter, 297 BluetoothAdapter* adapter,
298 BluetoothGattDescriptor* descriptor, 298 BluetoothGattDescriptor* descriptor,
299 const std::vector<uint8>& value) { 299 const std::vector<uint8_t>& value) {
300 ASSERT_EQ(adapter_.get(), adapter); 300 ASSERT_EQ(adapter_.get(), adapter);
301 301
302 ++gatt_descriptor_value_changed_count_; 302 ++gatt_descriptor_value_changed_count_;
303 last_gatt_descriptor_id_ = descriptor->GetIdentifier(); 303 last_gatt_descriptor_id_ = descriptor->GetIdentifier();
304 last_gatt_descriptor_uuid_ = descriptor->GetUUID(); 304 last_gatt_descriptor_uuid_ = descriptor->GetUUID();
305 last_changed_descriptor_value_ = value; 305 last_changed_descriptor_value_ = value;
306 306
307 ASSERT_TRUE(descriptor->GetCharacteristic()); 307 ASSERT_TRUE(descriptor->GetCharacteristic());
308 EXPECT_EQ( 308 EXPECT_EQ(
309 descriptor->GetCharacteristic()->GetDescriptor(last_gatt_descriptor_id_), 309 descriptor->GetCharacteristic()->GetDescriptor(last_gatt_descriptor_id_),
310 descriptor); 310 descriptor);
311 311
312 QuitMessageLoop(); 312 QuitMessageLoop();
313 } 313 }
314 314
315 void TestBluetoothAdapterObserver::QuitMessageLoop() { 315 void TestBluetoothAdapterObserver::QuitMessageLoop() {
316 if (base::MessageLoop::current() && 316 if (base::MessageLoop::current() &&
317 base::MessageLoop::current()->is_running()) 317 base::MessageLoop::current()->is_running())
318 base::MessageLoop::current()->QuitWhenIdle(); 318 base::MessageLoop::current()->QuitWhenIdle();
319 } 319 }
320 320
321 } // namespace device 321 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/test/test_bluetooth_adapter_observer.h ('k') | device/bluetooth/uribeacon/uri_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698