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

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

Issue 1749403002: Implement BluetoothRemoteGattCharacteristicWin::StartNotifySession and related unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change new_value->at(i) to (*new_value)[i] Created 4 years, 9 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/bluetooth_gatt_characteristic.h" 5 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 characteristic1_->StartNotifySession( 91 characteristic1_->StartNotifySession(
92 GetNotifyCallback(Call::NOT_EXPECTED), 92 GetNotifyCallback(Call::NOT_EXPECTED),
93 GetGattErrorCallback(Call::EXPECTED)); 93 GetGattErrorCallback(Call::EXPECTED));
94 return; 94 return;
95 } 95 }
96 96
97 characteristic1_->StartNotifySession( 97 characteristic1_->StartNotifySession(
98 GetNotifyCallback(Call::EXPECTED), 98 GetNotifyCallback(Call::EXPECTED),
99 GetGattErrorCallback(Call::NOT_EXPECTED)); 99 GetGattErrorCallback(Call::NOT_EXPECTED));
100 100
101 EXPECT_EQ(1, gatt_notify_characteristic_attempts_);
102 EXPECT_EQ(0, callback_count_); 101 EXPECT_EQ(0, callback_count_);
103 SimulateGattNotifySessionStarted(characteristic1_); 102 SimulateGattNotifySessionStarted(characteristic1_);
103 EXPECT_EQ(1, gatt_notify_characteristic_attempts_);
ortuno 2016/03/14 01:37:37 Since it's not related to notifications I think th
gogerald1 2016/03/15 00:48:19 Done. Mentioned in CL description.
104 EXPECT_EQ(1, callback_count_); 104 EXPECT_EQ(1, callback_count_);
105 EXPECT_EQ(0, error_callback_count_); 105 EXPECT_EQ(0, error_callback_count_);
106 ASSERT_EQ(1u, notify_sessions_.size()); 106 ASSERT_EQ(1u, notify_sessions_.size());
107 ASSERT_TRUE(notify_sessions_[0]); 107 ASSERT_TRUE(notify_sessions_[0]);
108 EXPECT_EQ(characteristic1_->GetIdentifier(), 108 EXPECT_EQ(characteristic1_->GetIdentifier(),
109 notify_sessions_[0]->GetCharacteristicIdentifier()); 109 notify_sessions_[0]->GetCharacteristicIdentifier());
110 EXPECT_TRUE(notify_sessions_[0]->IsActive()); 110 EXPECT_TRUE(notify_sessions_[0]->IsActive());
111 111
112 // Verify the Client Characteristic Configuration descriptor was written to. 112 // Verify the Client Characteristic Configuration descriptor was written to.
113 EXPECT_EQ(1, gatt_write_descriptor_attempts_); 113 EXPECT_EQ(1, gatt_write_descriptor_attempts_);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 #if defined(OS_ANDROID) || defined(OS_WIN) 267 #if defined(OS_ANDROID) || defined(OS_WIN)
268 // Tests ReadRemoteCharacteristic and GetValue with empty value buffer. 268 // Tests ReadRemoteCharacteristic and GetValue with empty value buffer.
269 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic_Empty) { 269 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic_Empty) {
270 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 270 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
271 BluetoothGattCharacteristic::PROPERTY_READ)); 271 BluetoothGattCharacteristic::PROPERTY_READ));
272 272
273 characteristic1_->ReadRemoteCharacteristic( 273 characteristic1_->ReadRemoteCharacteristic(
274 GetReadValueCallback(Call::EXPECTED), 274 GetReadValueCallback(Call::EXPECTED),
275 GetGattErrorCallback(Call::NOT_EXPECTED)); 275 GetGattErrorCallback(Call::NOT_EXPECTED));
276 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
277 std::vector<uint8_t> empty_vector; 276 std::vector<uint8_t> empty_vector;
278 SimulateGattCharacteristicRead(characteristic1_, empty_vector); 277 SimulateGattCharacteristicRead(characteristic1_, empty_vector);
279 278
280 // Duplicate read reported from OS shouldn't cause a problem: 279 // Duplicate read reported from OS shouldn't cause a problem:
281 SimulateGattCharacteristicRead(characteristic1_, empty_vector); 280 SimulateGattCharacteristicRead(characteristic1_, empty_vector);
282 281
282 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
283 EXPECT_EQ(empty_vector, last_read_value_); 283 EXPECT_EQ(empty_vector, last_read_value_);
284 EXPECT_EQ(empty_vector, characteristic1_->GetValue()); 284 EXPECT_EQ(empty_vector, characteristic1_->GetValue());
285 } 285 }
286 #endif // defined(OS_ANDROID) || defined(OS_WIN) 286 #endif // defined(OS_ANDROID) || defined(OS_WIN)
287 287
288 #if defined(OS_ANDROID) || defined(OS_WIN) 288 #if defined(OS_ANDROID) || defined(OS_WIN)
289 // Tests WriteRemoteCharacteristic with empty value buffer. 289 // Tests WriteRemoteCharacteristic with empty value buffer.
290 TEST_F(BluetoothGattCharacteristicTest, WriteRemoteCharacteristic_Empty) { 290 TEST_F(BluetoothGattCharacteristicTest, WriteRemoteCharacteristic_Empty) {
291 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 291 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
292 BluetoothGattCharacteristic::PROPERTY_WRITE)); 292 BluetoothGattCharacteristic::PROPERTY_WRITE));
293 293
294 std::vector<uint8_t> empty_vector; 294 std::vector<uint8_t> empty_vector;
295 characteristic1_->WriteRemoteCharacteristic( 295 characteristic1_->WriteRemoteCharacteristic(
296 empty_vector, GetCallback(Call::EXPECTED), 296 empty_vector, GetCallback(Call::EXPECTED),
297 GetGattErrorCallback(Call::NOT_EXPECTED)); 297 GetGattErrorCallback(Call::NOT_EXPECTED));
298 EXPECT_EQ(1, gatt_write_characteristic_attempts_);
299 SimulateGattCharacteristicWrite(characteristic1_); 298 SimulateGattCharacteristicWrite(characteristic1_);
300 299
300 EXPECT_EQ(1, gatt_write_characteristic_attempts_);
301 EXPECT_EQ(empty_vector, last_write_value_); 301 EXPECT_EQ(empty_vector, last_write_value_);
302 } 302 }
303 #endif // defined(OS_ANDROID) || defined(OS_WIN) 303 #endif // defined(OS_ANDROID) || defined(OS_WIN)
304 304
305 #if defined(OS_ANDROID) || defined(OS_WIN) 305 #if defined(OS_ANDROID) || defined(OS_WIN)
306 // Tests ReadRemoteCharacteristic completing after Chrome objects are deleted. 306 // Tests ReadRemoteCharacteristic completing after Chrome objects are deleted.
307 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic_AfterDeleted) { 307 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic_AfterDeleted) {
308 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 308 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
309 BluetoothGattCharacteristic::PROPERTY_READ)); 309 BluetoothGattCharacteristic::PROPERTY_READ));
310 310
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 #if defined(OS_ANDROID) || defined(OS_WIN) 345 #if defined(OS_ANDROID) || defined(OS_WIN)
346 // Tests ReadRemoteCharacteristic and GetValue with non-empty value buffer. 346 // Tests ReadRemoteCharacteristic and GetValue with non-empty value buffer.
347 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic) { 347 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic) {
348 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 348 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
349 BluetoothGattCharacteristic::PROPERTY_READ)); 349 BluetoothGattCharacteristic::PROPERTY_READ));
350 350
351 characteristic1_->ReadRemoteCharacteristic( 351 characteristic1_->ReadRemoteCharacteristic(
352 GetReadValueCallback(Call::EXPECTED), 352 GetReadValueCallback(Call::EXPECTED),
353 GetGattErrorCallback(Call::NOT_EXPECTED)); 353 GetGattErrorCallback(Call::NOT_EXPECTED));
354 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
355 354
356 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; 355 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff};
357 std::vector<uint8_t> test_vector(values, values + arraysize(values)); 356 std::vector<uint8_t> test_vector(values, values + arraysize(values));
358 SimulateGattCharacteristicRead(characteristic1_, test_vector); 357 SimulateGattCharacteristicRead(characteristic1_, test_vector);
359 358
360 // Duplicate read reported from OS shouldn't cause a problem: 359 // Duplicate read reported from OS shouldn't cause a problem:
361 std::vector<uint8_t> empty_vector; 360 std::vector<uint8_t> empty_vector;
362 SimulateGattCharacteristicRead(characteristic1_, empty_vector); 361 SimulateGattCharacteristicRead(characteristic1_, empty_vector);
363 362
363 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
364 EXPECT_EQ(test_vector, last_read_value_); 364 EXPECT_EQ(test_vector, last_read_value_);
365 EXPECT_EQ(test_vector, characteristic1_->GetValue()); 365 EXPECT_EQ(test_vector, characteristic1_->GetValue());
366 } 366 }
367 #endif // defined(OS_ANDROID) || defined(OS_WIN) 367 #endif // defined(OS_ANDROID) || defined(OS_WIN)
368 368
369 #if defined(OS_ANDROID) || defined(OS_WIN) 369 #if defined(OS_ANDROID) || defined(OS_WIN)
370 // Tests WriteRemoteCharacteristic with non-empty value buffer. 370 // Tests WriteRemoteCharacteristic with non-empty value buffer.
371 TEST_F(BluetoothGattCharacteristicTest, WriteRemoteCharacteristic) { 371 TEST_F(BluetoothGattCharacteristicTest, WriteRemoteCharacteristic) {
372 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 372 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
373 BluetoothGattCharacteristic::PROPERTY_WRITE)); 373 BluetoothGattCharacteristic::PROPERTY_WRITE));
374 374
375 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; 375 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff};
376 std::vector<uint8_t> test_vector(values, values + arraysize(values)); 376 std::vector<uint8_t> test_vector(values, values + arraysize(values));
377 characteristic1_->WriteRemoteCharacteristic( 377 characteristic1_->WriteRemoteCharacteristic(
378 test_vector, GetCallback(Call::EXPECTED), 378 test_vector, GetCallback(Call::EXPECTED),
379 GetGattErrorCallback(Call::NOT_EXPECTED)); 379 GetGattErrorCallback(Call::NOT_EXPECTED));
380 EXPECT_EQ(1, gatt_write_characteristic_attempts_);
381 380
382 SimulateGattCharacteristicWrite(characteristic1_); 381 SimulateGattCharacteristicWrite(characteristic1_);
383 382
383 EXPECT_EQ(1, gatt_write_characteristic_attempts_);
384 EXPECT_EQ(test_vector, last_write_value_); 384 EXPECT_EQ(test_vector, last_write_value_);
385 } 385 }
386 #endif // defined(OS_ANDROID) || defined(OS_WIN) 386 #endif // defined(OS_ANDROID) || defined(OS_WIN)
387 387
388 #if defined(OS_ANDROID) || defined(OS_WIN) 388 #if defined(OS_ANDROID) || defined(OS_WIN)
389 // Tests ReadRemoteCharacteristic and GetValue multiple times. 389 // Tests ReadRemoteCharacteristic and GetValue multiple times.
390 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic_Twice) { 390 TEST_F(BluetoothGattCharacteristicTest, ReadRemoteCharacteristic_Twice) {
391 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 391 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
392 BluetoothGattCharacteristic::PROPERTY_READ)); 392 BluetoothGattCharacteristic::PROPERTY_READ));
393 393
394 characteristic1_->ReadRemoteCharacteristic( 394 characteristic1_->ReadRemoteCharacteristic(
395 GetReadValueCallback(Call::EXPECTED), 395 GetReadValueCallback(Call::EXPECTED),
396 GetGattErrorCallback(Call::NOT_EXPECTED)); 396 GetGattErrorCallback(Call::NOT_EXPECTED));
397 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
398 397
399 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; 398 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff};
400 std::vector<uint8_t> test_vector(values, values + arraysize(values)); 399 std::vector<uint8_t> test_vector(values, values + arraysize(values));
401 SimulateGattCharacteristicRead(characteristic1_, test_vector); 400 SimulateGattCharacteristicRead(characteristic1_, test_vector);
401 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
402 EXPECT_EQ(1, callback_count_); 402 EXPECT_EQ(1, callback_count_);
403 EXPECT_EQ(0, error_callback_count_); 403 EXPECT_EQ(0, error_callback_count_);
404 EXPECT_EQ(test_vector, last_read_value_); 404 EXPECT_EQ(test_vector, last_read_value_);
405 EXPECT_EQ(test_vector, characteristic1_->GetValue()); 405 EXPECT_EQ(test_vector, characteristic1_->GetValue());
406 406
407 // Read again, with different value: 407 // Read again, with different value:
408 ResetEventCounts(); 408 ResetEventCounts();
409 characteristic1_->ReadRemoteCharacteristic( 409 characteristic1_->ReadRemoteCharacteristic(
410 GetReadValueCallback(Call::EXPECTED), 410 GetReadValueCallback(Call::EXPECTED),
411 GetGattErrorCallback(Call::NOT_EXPECTED)); 411 GetGattErrorCallback(Call::NOT_EXPECTED));
412 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
413 std::vector<uint8_t> empty_vector; 412 std::vector<uint8_t> empty_vector;
414 SimulateGattCharacteristicRead(characteristic1_, empty_vector); 413 SimulateGattCharacteristicRead(characteristic1_, empty_vector);
414 EXPECT_EQ(1, gatt_read_characteristic_attempts_);
415 EXPECT_EQ(1, callback_count_); 415 EXPECT_EQ(1, callback_count_);
416 EXPECT_EQ(0, error_callback_count_); 416 EXPECT_EQ(0, error_callback_count_);
417 EXPECT_EQ(empty_vector, last_read_value_); 417 EXPECT_EQ(empty_vector, last_read_value_);
418 EXPECT_EQ(empty_vector, characteristic1_->GetValue()); 418 EXPECT_EQ(empty_vector, characteristic1_->GetValue());
419 } 419 }
420 #endif // defined(OS_ANDROID) || defined(OS_WIN) 420 #endif // defined(OS_ANDROID) || defined(OS_WIN)
421 421
422 #if defined(OS_ANDROID) || defined(OS_WIN) 422 #if defined(OS_ANDROID) || defined(OS_WIN)
423 // Tests WriteRemoteCharacteristic multiple times. 423 // Tests WriteRemoteCharacteristic multiple times.
424 TEST_F(BluetoothGattCharacteristicTest, WriteRemoteCharacteristic_Twice) { 424 TEST_F(BluetoothGattCharacteristicTest, WriteRemoteCharacteristic_Twice) {
425 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 425 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
426 BluetoothGattCharacteristic::PROPERTY_WRITE)); 426 BluetoothGattCharacteristic::PROPERTY_WRITE));
427 427
428 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff}; 428 uint8_t values[] = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff};
429 std::vector<uint8_t> test_vector(values, values + arraysize(values)); 429 std::vector<uint8_t> test_vector(values, values + arraysize(values));
430 characteristic1_->WriteRemoteCharacteristic( 430 characteristic1_->WriteRemoteCharacteristic(
431 test_vector, GetCallback(Call::EXPECTED), 431 test_vector, GetCallback(Call::EXPECTED),
432 GetGattErrorCallback(Call::NOT_EXPECTED)); 432 GetGattErrorCallback(Call::NOT_EXPECTED));
433 EXPECT_EQ(1, gatt_write_characteristic_attempts_);
434 433
435 SimulateGattCharacteristicWrite(characteristic1_); 434 SimulateGattCharacteristicWrite(characteristic1_);
435 EXPECT_EQ(1, gatt_write_characteristic_attempts_);
436 EXPECT_EQ(1, callback_count_); 436 EXPECT_EQ(1, callback_count_);
437 EXPECT_EQ(0, error_callback_count_); 437 EXPECT_EQ(0, error_callback_count_);
438 EXPECT_EQ(test_vector, last_write_value_); 438 EXPECT_EQ(test_vector, last_write_value_);
439 439
440 // Write again, with different value: 440 // Write again, with different value:
441 ResetEventCounts(); 441 ResetEventCounts();
442 std::vector<uint8_t> empty_vector; 442 std::vector<uint8_t> empty_vector;
443 characteristic1_->WriteRemoteCharacteristic( 443 characteristic1_->WriteRemoteCharacteristic(
444 empty_vector, GetCallback(Call::EXPECTED), 444 empty_vector, GetCallback(Call::EXPECTED),
445 GetGattErrorCallback(Call::NOT_EXPECTED)); 445 GetGattErrorCallback(Call::NOT_EXPECTED));
446
447 SimulateGattCharacteristicWrite(characteristic1_);
446 EXPECT_EQ(1, gatt_write_characteristic_attempts_); 448 EXPECT_EQ(1, gatt_write_characteristic_attempts_);
447 SimulateGattCharacteristicWrite(characteristic1_);
448 EXPECT_EQ(1, callback_count_); 449 EXPECT_EQ(1, callback_count_);
449 EXPECT_EQ(0, error_callback_count_); 450 EXPECT_EQ(0, error_callback_count_);
450 EXPECT_EQ(empty_vector, last_write_value_); 451 EXPECT_EQ(empty_vector, last_write_value_);
451 } 452 }
452 #endif // defined(OS_ANDROID) || defined(OS_WIN) 453 #endif // defined(OS_ANDROID) || defined(OS_WIN)
453 454
454 #if defined(OS_ANDROID) || defined(OS_WIN) 455 #if defined(OS_ANDROID) || defined(OS_WIN)
455 // Tests ReadRemoteCharacteristic on two characteristics. 456 // Tests ReadRemoteCharacteristic on two characteristics.
456 TEST_F(BluetoothGattCharacteristicTest, 457 TEST_F(BluetoothGattCharacteristicTest,
457 ReadRemoteCharacteristic_MultipleCharacteristics) { 458 ReadRemoteCharacteristic_MultipleCharacteristics) {
458 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( 459 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
459 BluetoothGattCharacteristic::PROPERTY_READ)); 460 BluetoothGattCharacteristic::PROPERTY_READ));
460 461
461 characteristic1_->ReadRemoteCharacteristic( 462 characteristic1_->ReadRemoteCharacteristic(
462 GetReadValueCallback(Call::EXPECTED), 463 GetReadValueCallback(Call::EXPECTED),
463 GetGattErrorCallback(Call::NOT_EXPECTED)); 464 GetGattErrorCallback(Call::NOT_EXPECTED));
464 characteristic2_->ReadRemoteCharacteristic( 465 characteristic2_->ReadRemoteCharacteristic(
465 GetReadValueCallback(Call::EXPECTED), 466 GetReadValueCallback(Call::EXPECTED),
466 GetGattErrorCallback(Call::NOT_EXPECTED)); 467 GetGattErrorCallback(Call::NOT_EXPECTED));
467 EXPECT_EQ(2, gatt_read_characteristic_attempts_);
468 EXPECT_EQ(0, callback_count_); 468 EXPECT_EQ(0, callback_count_);
469 EXPECT_EQ(0, error_callback_count_); 469 EXPECT_EQ(0, error_callback_count_);
470 470
471 std::vector<uint8_t> test_vector1; 471 std::vector<uint8_t> test_vector1;
472 test_vector1.push_back(111); 472 test_vector1.push_back(111);
473 SimulateGattCharacteristicRead(characteristic1_, test_vector1); 473 SimulateGattCharacteristicRead(characteristic1_, test_vector1);
474 EXPECT_EQ(test_vector1, last_read_value_); 474 EXPECT_EQ(test_vector1, last_read_value_);
475 475
476 std::vector<uint8_t> test_vector2; 476 std::vector<uint8_t> test_vector2;
477 test_vector2.push_back(222); 477 test_vector2.push_back(222);
478 SimulateGattCharacteristicRead(characteristic2_, test_vector2); 478 SimulateGattCharacteristicRead(characteristic2_, test_vector2);
479 EXPECT_EQ(test_vector2, last_read_value_); 479 EXPECT_EQ(test_vector2, last_read_value_);
480 480
481 EXPECT_EQ(2, gatt_read_characteristic_attempts_);
481 EXPECT_EQ(2, callback_count_); 482 EXPECT_EQ(2, callback_count_);
482 EXPECT_EQ(0, error_callback_count_); 483 EXPECT_EQ(0, error_callback_count_);
483 EXPECT_EQ(test_vector1, characteristic1_->GetValue()); 484 EXPECT_EQ(test_vector1, characteristic1_->GetValue());
484 EXPECT_EQ(test_vector2, characteristic2_->GetValue()); 485 EXPECT_EQ(test_vector2, characteristic2_->GetValue());
485 } 486 }
486 #endif // defined(OS_ANDROID) || defined(OS_WIN) 487 #endif // defined(OS_ANDROID) || defined(OS_WIN)
487 488
488 #if defined(OS_ANDROID) || defined(OS_WIN) 489 #if defined(OS_ANDROID) || defined(OS_WIN)
489 // Tests WriteRemoteCharacteristic on two characteristics. 490 // Tests WriteRemoteCharacteristic on two characteristics.
490 TEST_F(BluetoothGattCharacteristicTest, 491 TEST_F(BluetoothGattCharacteristicTest,
(...skipping 12 matching lines...) Expand all
503 504
504 std::vector<uint8_t> test_vector2; 505 std::vector<uint8_t> test_vector2;
505 test_vector2.push_back(222); 506 test_vector2.push_back(222);
506 characteristic2_->WriteRemoteCharacteristic( 507 characteristic2_->WriteRemoteCharacteristic(
507 test_vector2, GetCallback(Call::EXPECTED), 508 test_vector2, GetCallback(Call::EXPECTED),
508 GetGattErrorCallback(Call::NOT_EXPECTED)); 509 GetGattErrorCallback(Call::NOT_EXPECTED));
509 #ifdef OS_ANDROID 510 #ifdef OS_ANDROID
510 EXPECT_EQ(test_vector2, last_write_value_); 511 EXPECT_EQ(test_vector2, last_write_value_);
511 #endif 512 #endif
512 513
513 EXPECT_EQ(2, gatt_write_characteristic_attempts_);
514 EXPECT_EQ(0, callback_count_); 514 EXPECT_EQ(0, callback_count_);
515 EXPECT_EQ(0, error_callback_count_); 515 EXPECT_EQ(0, error_callback_count_);
516 516
517 SimulateGattCharacteristicWrite(characteristic1_); 517 SimulateGattCharacteristicWrite(characteristic1_);
518 #ifndef OS_ANDROID 518 #ifndef OS_ANDROID
519 EXPECT_EQ(test_vector1, last_write_value_); 519 EXPECT_EQ(test_vector1, last_write_value_);
520 #endif 520 #endif
521 521
522 SimulateGattCharacteristicWrite(characteristic2_); 522 SimulateGattCharacteristicWrite(characteristic2_);
523 #ifndef OS_ANDROID 523 #ifndef OS_ANDROID
524 EXPECT_EQ(test_vector2, last_write_value_); 524 EXPECT_EQ(test_vector2, last_write_value_);
525 #endif 525 #endif
526 526
527 EXPECT_EQ(2, gatt_write_characteristic_attempts_);
527 EXPECT_EQ(2, callback_count_); 528 EXPECT_EQ(2, callback_count_);
528 EXPECT_EQ(0, error_callback_count_); 529 EXPECT_EQ(0, error_callback_count_);
529 530
530 // TODO(crbug.com/591740): Remove if define for OS_ANDROID in this test. 531 // TODO(crbug.com/591740): Remove if define for OS_ANDROID in this test.
531 } 532 }
532 #endif // defined(OS_ANDROID) || defined(OS_WIN) 533 #endif // defined(OS_ANDROID) || defined(OS_WIN)
533 534
534 #if defined(OS_ANDROID) || defined(OS_WIN) 535 #if defined(OS_ANDROID) || defined(OS_WIN)
535 // Tests ReadRemoteCharacteristic asynchronous error. 536 // Tests ReadRemoteCharacteristic asynchronous error.
536 TEST_F(BluetoothGattCharacteristicTest, ReadError) { 537 TEST_F(BluetoothGattCharacteristicTest, ReadError) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 last_gatt_error_code_); 737 last_gatt_error_code_);
737 738
738 // Initial read should still succeed: 739 // Initial read should still succeed:
739 ResetEventCounts(); 740 ResetEventCounts();
740 SimulateGattCharacteristicRead(characteristic1_, empty_vector); 741 SimulateGattCharacteristicRead(characteristic1_, empty_vector);
741 EXPECT_EQ(1, callback_count_); 742 EXPECT_EQ(1, callback_count_);
742 EXPECT_EQ(0, error_callback_count_); 743 EXPECT_EQ(0, error_callback_count_);
743 } 744 }
744 #endif // defined(OS_ANDROID) || defined(OS_WIN) 745 #endif // defined(OS_ANDROID) || defined(OS_WIN)
745 746
746 #if defined(OS_ANDROID) 747 #if defined(OS_ANDROID) || defined(OS_WIN)
ortuno 2016/03/14 01:37:37 I think you misunderstood the purpose of these tes
scheib 2016/03/14 17:54:46 I agree with everything above. gogerald@ please ad
gogerald1 2016/03/15 00:48:19 Done.
gogerald1 2016/03/15 00:48:19 Done.
747 // StartNotifySession fails if characteristic doesn't have Notify or Indicate 748 // StartNotifySession fails if characteristic doesn't have Notify or Indicate
748 // property. 749 // property.
749 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_NoNotifyOrIndicate) { 750 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_NoNotifyOrIndicate) {
750 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 751 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
751 /* properties: NOTIFY */ 0x10, 752 /* properties: NOTIFY */ 0x10,
752 /* expected_config_descriptor_value: NOTIFY */ 1, 753 /* expected_config_descriptor_value: NOTIFY */ 1,
753 StartNotifySetupError::CHARACTERISTIC_PROPERTIES)); 754 StartNotifySetupError::CHARACTERISTIC_PROPERTIES));
754 755
755 EXPECT_EQ(0, gatt_notify_characteristic_attempts_); 756 EXPECT_EQ(0, gatt_notify_characteristic_attempts_);
756 757
757 // The expected error callback is asynchronous: 758 // The expected error callback is asynchronous:
758 EXPECT_EQ(0, error_callback_count_); 759 EXPECT_EQ(0, error_callback_count_);
759 base::RunLoop().RunUntilIdle(); 760 RunUntilIdle();
760 EXPECT_EQ(1, error_callback_count_); 761 EXPECT_EQ(1, error_callback_count_);
761 } 762 }
762 #endif // defined(OS_ANDROID) 763 #endif // defined(OS_ANDROID) || defined(OS_WIN)
763 764
764 #if defined(OS_ANDROID) 765 #if defined(OS_ANDROID) || defined(OS_WIN)
765 // StartNotifySession fails if the characteristic is missing the Client 766 // StartNotifySession fails if the characteristic is missing the Client
766 // Characteristic Configuration descriptor. 767 // Characteristic Configuration descriptor.
767 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_NoConfigDescriptor) { 768 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_NoConfigDescriptor) {
768 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 769 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
769 /* properties: NOTIFY */ 0x10, 770 /* properties: NOTIFY */ 0x10,
770 /* expected_config_descriptor_value: NOTIFY */ 1, 771 /* expected_config_descriptor_value: NOTIFY */ 1,
771 StartNotifySetupError::CONFIG_DESCRIPTOR_MISSING)); 772 StartNotifySetupError::CONFIG_DESCRIPTOR_MISSING));
772 773
773 EXPECT_EQ(0, gatt_notify_characteristic_attempts_); 774 EXPECT_EQ(0, gatt_notify_characteristic_attempts_);
774 775
775 // The expected error callback is asynchronous: 776 // The expected error callback is asynchronous:
776 EXPECT_EQ(0, error_callback_count_); 777 EXPECT_EQ(0, error_callback_count_);
777 base::RunLoop().RunUntilIdle(); 778 RunUntilIdle();
778 EXPECT_EQ(1, error_callback_count_); 779 EXPECT_EQ(1, error_callback_count_);
779 } 780 }
780 #endif // defined(OS_ANDROID) 781 #endif // defined(OS_ANDROID) || defined(OS_WIN)
781 782
782 #if defined(OS_ANDROID) 783 #if defined(OS_ANDROID) || defined(OS_WIN)
783 // StartNotifySession fails synchronously when failing to set a characteristic 784 // StartNotifySession fails synchronously when failing to set a characteristic
784 // to enable notifications. 785 // to enable notifications.
785 // Android: This is mBluetoothGatt.setCharacteristicNotification failing. 786 // Android: This is mBluetoothGatt.setCharacteristicNotification failing.
786 TEST_F(BluetoothGattCharacteristicTest, 787 TEST_F(BluetoothGattCharacteristicTest,
787 StartNotifySession_FailToSetCharacteristicNotification) { 788 StartNotifySession_FailToSetCharacteristicNotification) {
788 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 789 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
789 /* properties: NOTIFY */ 0x10, 790 /* properties: NOTIFY */ 0x10,
790 /* expected_config_descriptor_value: NOTIFY */ 1, 791 /* expected_config_descriptor_value: NOTIFY */ 1,
791 StartNotifySetupError::SET_NOTIFY)); 792 StartNotifySetupError::SET_NOTIFY));
792 793
793 // The expected error callback is asynchronous: 794 // The expected error callback is asynchronous:
794 EXPECT_EQ(0, error_callback_count_); 795 EXPECT_EQ(0, error_callback_count_);
795 base::RunLoop().RunUntilIdle(); 796 RunUntilIdle();
796 EXPECT_EQ(1, error_callback_count_); 797 EXPECT_EQ(1, error_callback_count_);
797 798
798 EXPECT_EQ(0, gatt_notify_characteristic_attempts_); 799 EXPECT_EQ(0, gatt_notify_characteristic_attempts_);
799 ASSERT_EQ(0u, notify_sessions_.size()); 800 ASSERT_EQ(0u, notify_sessions_.size());
800 } 801 }
801 #endif // defined(OS_ANDROID) 802 #endif // defined(OS_ANDROID) || defined(OS_WIN)
802 803
803 #if defined(OS_ANDROID) 804 #if defined(OS_ANDROID) || defined(OS_WIN)
804 // Tests StartNotifySession descriptor write synchronous failure. 805 // Tests StartNotifySession descriptor write synchronous failure.
805 TEST_F(BluetoothGattCharacteristicTest, 806 TEST_F(BluetoothGattCharacteristicTest,
806 StartNotifySession_WriteDescriptorSynchronousError) { 807 StartNotifySession_WriteDescriptorSynchronousError) {
807 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 808 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
808 /* properties: NOTIFY */ 0x10, 809 /* properties: NOTIFY */ 0x10,
809 /* expected_config_descriptor_value: NOTIFY */ 1, 810 /* expected_config_descriptor_value: NOTIFY */ 1,
810 StartNotifySetupError::WRITE_DESCRIPTOR)); 811 StartNotifySetupError::WRITE_DESCRIPTOR));
811 812
812 // The expected error callback is asynchronous: 813 // The expected error callback is asynchronous:
813 EXPECT_EQ(0, error_callback_count_); 814 EXPECT_EQ(0, error_callback_count_);
814 base::RunLoop().RunUntilIdle(); 815 RunUntilIdle();
815 EXPECT_EQ(1, error_callback_count_); 816 EXPECT_EQ(1, error_callback_count_);
816 817
817 EXPECT_EQ(1, gatt_notify_characteristic_attempts_); 818 EXPECT_EQ(1, gatt_notify_characteristic_attempts_);
818 ASSERT_EQ(0u, notify_sessions_.size()); 819 ASSERT_EQ(0u, notify_sessions_.size());
819 } 820 }
820 #endif // defined(OS_ANDROID) 821 #endif // defined(OS_ANDROID) || defined(OS_WIN)
821 822
822 #if defined(OS_ANDROID) 823 #if defined(OS_ANDROID) || defined(OS_WIN)
823 // Tests StartNotifySession success on a characteristic enabling Notify. 824 // Tests StartNotifySession success on a characteristic enabling Notify.
824 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession) { 825 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession) {
825 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 826 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
826 /* properties: NOTIFY */ 0x10, 827 /* properties: NOTIFY */ 0x10,
827 /* expected_config_descriptor_value: NOTIFY */ 1)); 828 /* expected_config_descriptor_value: NOTIFY */ 1));
828 } 829 }
829 #endif // defined(OS_ANDROID) 830 #endif // defined(OS_ANDROID) || defined(OS_WIN)
830 831
831 #if defined(OS_ANDROID) 832 #if defined(OS_ANDROID) || defined(OS_WIN)
832 // Tests StartNotifySession success on a characteristic enabling Indicate. 833 // Tests StartNotifySession success on a characteristic enabling Indicate.
833 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_OnIndicate) { 834 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_OnIndicate) {
834 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 835 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
835 /* properties: INDICATE */ 0x20, 836 /* properties: INDICATE */ 0x20,
836 /* expected_config_descriptor_value: INDICATE */ 2)); 837 /* expected_config_descriptor_value: INDICATE */ 2));
837 } 838 }
838 #endif // defined(OS_ANDROID) 839 #endif // defined(OS_ANDROID) || defined(OS_WIN)
839 840
840 #if defined(OS_ANDROID) 841 #if defined(OS_ANDROID) || defined(OS_WIN)
841 // Tests StartNotifySession success on a characteristic enabling Notify & 842 // Tests StartNotifySession success on a characteristic enabling Notify &
842 // Indicate. 843 // Indicate.
843 TEST_F(BluetoothGattCharacteristicTest, 844 TEST_F(BluetoothGattCharacteristicTest,
844 StartNotifySession_OnNotifyAndIndicate) { 845 StartNotifySession_OnNotifyAndIndicate) {
845 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 846 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
846 /* properties: NOTIFY and INDICATE bits set */ 0x30, 847 /* properties: NOTIFY and INDICATE bits set */ 0x30,
847 /* expected_config_descriptor_value: NOTIFY */ 1)); 848 /* expected_config_descriptor_value: NOTIFY */ 1));
848 } 849 }
849 #endif // defined(OS_ANDROID) 850 #endif // defined(OS_ANDROID) || defined(OS_WIN)
850 851
851 #if defined(OS_ANDROID) 852 #if defined(OS_ANDROID) || defined(OS_WIN)
852 // Tests Characteristic Value changes during a Notify Session. 853 // Tests Characteristic Value changes during a Notify Session.
853 TEST_F(BluetoothGattCharacteristicTest, GattCharacteristicValueChanged) { 854 TEST_F(BluetoothGattCharacteristicTest, GattCharacteristicValueChanged) {
854 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 855 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
855 /* properties: NOTIFY */ 0x10, 856 /* properties: NOTIFY */ 0x10,
856 /* expected_config_descriptor_value: NOTIFY */ 1)); 857 /* expected_config_descriptor_value: NOTIFY */ 1));
857 858
858 TestBluetoothAdapterObserver observer(adapter_); 859 TestBluetoothAdapterObserver observer(adapter_);
859 860
860 std::vector<uint8_t> test_vector1, test_vector2; 861 std::vector<uint8_t> test_vector1, test_vector2;
861 test_vector1.push_back(111); 862 test_vector1.push_back(111);
862 test_vector2.push_back(222); 863 test_vector2.push_back(222);
863 864
864 SimulateGattCharacteristicChanged(characteristic1_, test_vector1); 865 SimulateGattCharacteristicChanged(characteristic1_, test_vector1);
865 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); 866 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count());
866 EXPECT_EQ(test_vector1, characteristic1_->GetValue()); 867 EXPECT_EQ(test_vector1, characteristic1_->GetValue());
867 868
868 SimulateGattCharacteristicChanged(characteristic1_, test_vector2); 869 SimulateGattCharacteristicChanged(characteristic1_, test_vector2);
869 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count()); 870 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count());
870 EXPECT_EQ(test_vector2, characteristic1_->GetValue()); 871 EXPECT_EQ(test_vector2, characteristic1_->GetValue());
871 } 872 }
872 #endif // defined(OS_ANDROID) 873 #endif // defined(OS_ANDROID) || defined(OS_WIN)
873 874
874 #if defined(OS_ANDROID) 875 #if defined(OS_ANDROID)
875 // Tests Characteristic Value changing after a Notify Session and objects being 876 // Tests Characteristic Value changing after a Notify Session and objects being
876 // destroyed. 877 // destroyed.
878 // On Windows, characteristic changed notification is not available after
879 // deleting the device.
ortuno 2016/03/14 01:37:37 [...] after deleting the device because we synchro
gogerald1 2016/03/15 00:48:19 Done.
877 TEST_F(BluetoothGattCharacteristicTest, 880 TEST_F(BluetoothGattCharacteristicTest,
878 GattCharacteristicValueChanged_AfterDeleted) { 881 GattCharacteristicValueChanged_AfterDeleted) {
879 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( 882 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
880 /* properties: NOTIFY */ 0x10, 883 /* properties: NOTIFY */ 0x10,
881 /* expected_config_descriptor_value: NOTIFY */ 1)); 884 /* expected_config_descriptor_value: NOTIFY */ 1));
882 885
883 RememberCharacteristicForSubsequentAction(characteristic1_); 886 RememberCharacteristicForSubsequentAction(characteristic1_);
884 DeleteDevice(device_); 887 DeleteDevice(device_);
885 888
886 std::vector<uint8_t> empty_vector; 889 std::vector<uint8_t> empty_vector;
887 SimulateGattCharacteristicChanged(/* use remembered characteristic */ nullptr, 890 SimulateGattCharacteristicChanged(/* use remembered characteristic */ nullptr,
888 empty_vector); 891 empty_vector);
889 EXPECT_TRUE("Did not crash!"); 892 EXPECT_TRUE("Did not crash!");
890 } 893 }
891 #endif // defined(OS_ANDROID) 894 #endif // defined(OS_ANDROID)
892 895
893 #if defined(OS_ANDROID) 896 #if defined(OS_ANDROID) || defined(OS_WIN)
894 // Tests multiple StartNotifySession success. 897 // Tests multiple StartNotifySession success.
895 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_Multiple) { 898 TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_Multiple) {
896 ASSERT_NO_FATAL_FAILURE( 899 ASSERT_NO_FATAL_FAILURE(
897 FakeCharacteristicBoilerplate(/* properties: NOTIFY */ 0x10)); 900 FakeCharacteristicBoilerplate(/* properties: NOTIFY */ 0x10));
898 SimulateGattDescriptor( 901 SimulateGattDescriptor(
899 characteristic1_, 902 characteristic1_,
900 /* Client Characteristic Configuration descriptor's standard UUID: */ 903 /* Client Characteristic Configuration descriptor's standard UUID: */
901 "00002902-0000-1000-8000-00805F9B34FB"); 904 "00002902-0000-1000-8000-00805F9B34FB");
902 ASSERT_EQ(1u, characteristic1_->GetDescriptors().size()); 905 ASSERT_EQ(1u, characteristic1_->GetDescriptors().size());
903 906
904 characteristic1_->StartNotifySession( 907 characteristic1_->StartNotifySession(
905 GetNotifyCallback(Call::EXPECTED), 908 GetNotifyCallback(Call::EXPECTED),
906 GetGattErrorCallback(Call::NOT_EXPECTED)); 909 GetGattErrorCallback(Call::NOT_EXPECTED));
907 characteristic1_->StartNotifySession( 910 characteristic1_->StartNotifySession(
908 GetNotifyCallback(Call::EXPECTED), 911 GetNotifyCallback(Call::EXPECTED),
909 GetGattErrorCallback(Call::NOT_EXPECTED)); 912 GetGattErrorCallback(Call::NOT_EXPECTED));
913
914 EXPECT_EQ(0, callback_count_);
915 SimulateGattNotifySessionStarted(characteristic1_);
910 #if defined(OS_ANDROID) 916 #if defined(OS_ANDROID)
911 // TODO(crbug.com/551634): Decide when implementing IsNotifying if Android 917 // TODO(crbug.com/551634): Decide when implementing IsNotifying if Android
912 // should trust the notification request always worked, or if we should always 918 // should trust the notification request always worked, or if we should always
913 // redundantly set the value to the OS. 919 // redundantly set the value to the OS.
914 EXPECT_EQ(2, gatt_notify_characteristic_attempts_); 920 EXPECT_EQ(2, gatt_notify_characteristic_attempts_);
915 #else 921 #else
916 EXPECT_EQ(1, gatt_notify_characteristic_attempts_); 922 EXPECT_EQ(1, gatt_notify_characteristic_attempts_);
917 #endif 923 #endif
918 EXPECT_EQ(0, callback_count_);
919 SimulateGattNotifySessionStarted(characteristic1_);
920 EXPECT_EQ(2, callback_count_); 924 EXPECT_EQ(2, callback_count_);
921 EXPECT_EQ(0, error_callback_count_); 925 EXPECT_EQ(0, error_callback_count_);
922 ASSERT_EQ(2u, notify_sessions_.size()); 926 ASSERT_EQ(2u, notify_sessions_.size());
923 ASSERT_TRUE(notify_sessions_[0]); 927 ASSERT_TRUE(notify_sessions_[0]);
924 ASSERT_TRUE(notify_sessions_[1]); 928 ASSERT_TRUE(notify_sessions_[1]);
925 EXPECT_EQ(characteristic1_->GetIdentifier(), 929 EXPECT_EQ(characteristic1_->GetIdentifier(),
926 notify_sessions_[0]->GetCharacteristicIdentifier()); 930 notify_sessions_[0]->GetCharacteristicIdentifier());
927 EXPECT_EQ(characteristic1_->GetIdentifier(), 931 EXPECT_EQ(characteristic1_->GetIdentifier(),
928 notify_sessions_[1]->GetCharacteristicIdentifier()); 932 notify_sessions_[1]->GetCharacteristicIdentifier());
929 EXPECT_TRUE(notify_sessions_[0]->IsActive()); 933 EXPECT_TRUE(notify_sessions_[0]->IsActive());
930 EXPECT_TRUE(notify_sessions_[1]->IsActive()); 934 EXPECT_TRUE(notify_sessions_[1]->IsActive());
931 } 935 }
932 #endif // defined(OS_ANDROID) 936 #endif // defined(OS_ANDROID) || defined(OS_WIN)
933 937
934 #if defined(OS_ANDROID) || defined(OS_WIN) 938 #if defined(OS_ANDROID) || defined(OS_WIN)
935 TEST_F(BluetoothGattCharacteristicTest, GetDescriptors_FindNone) { 939 TEST_F(BluetoothGattCharacteristicTest, GetDescriptors_FindNone) {
936 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate()); 940 ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate());
937 941
938 EXPECT_EQ(0u, characteristic1_->GetDescriptors().size()); 942 EXPECT_EQ(0u, characteristic1_->GetDescriptors().size());
939 } 943 }
940 #endif // defined(OS_ANDROID) || defined(OS_WIN) 944 #endif // defined(OS_ANDROID) || defined(OS_WIN)
941 945
942 #if defined(OS_ANDROID) || defined(OS_WIN) 946 #if defined(OS_ANDROID) || defined(OS_WIN)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 982
979 // Characteristic 1 has descriptor uuids 1 and 2 (we don't know the order). 983 // Characteristic 1 has descriptor uuids 1 and 2 (we don't know the order).
980 EXPECT_TRUE(c1_uuid1 == uuid1 || c1_uuid2 == uuid1); 984 EXPECT_TRUE(c1_uuid1 == uuid1 || c1_uuid2 == uuid1);
981 EXPECT_TRUE(c1_uuid1 == uuid2 || c1_uuid2 == uuid2); 985 EXPECT_TRUE(c1_uuid1 == uuid2 || c1_uuid2 == uuid2);
982 // ... but not uuid 3 986 // ... but not uuid 3
983 EXPECT_FALSE(c1_uuid1 == uuid3 || c1_uuid2 == uuid3); 987 EXPECT_FALSE(c1_uuid1 == uuid3 || c1_uuid2 == uuid3);
984 } 988 }
985 #endif // defined(OS_ANDROID) || defined(OS_WIN) 989 #endif // defined(OS_ANDROID) || defined(OS_WIN)
986 990
987 } // namespace device 991 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698