Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_device.h" | 5 #include "device/bluetooth/bluetooth_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 // multiple errors should only invoke callbacks once. | 448 // multiple errors should only invoke callbacks once. |
| 449 TEST_F(BluetoothTest, BluetoothGattConnection_ErrorAfterConnection) { | 449 TEST_F(BluetoothTest, BluetoothGattConnection_ErrorAfterConnection) { |
| 450 InitWithFakeAdapter(); | 450 InitWithFakeAdapter(); |
| 451 StartLowEnergyDiscoverySession(); | 451 StartLowEnergyDiscoverySession(); |
| 452 BluetoothDevice* device = DiscoverLowEnergyDevice(3); | 452 BluetoothDevice* device = DiscoverLowEnergyDevice(3); |
| 453 | 453 |
| 454 ResetEventCounts(); | 454 ResetEventCounts(); |
| 455 device->CreateGattConnection(GetGattConnectionCallback(Call::NOT_EXPECTED), | 455 device->CreateGattConnection(GetGattConnectionCallback(Call::NOT_EXPECTED), |
| 456 GetConnectErrorCallback(Call::EXPECTED)); | 456 GetConnectErrorCallback(Call::EXPECTED)); |
| 457 EXPECT_EQ(1, gatt_connection_attempts_); | 457 EXPECT_EQ(1, gatt_connection_attempts_); |
| 458 SimulateGattConnectionError(device, BluetoothDevice::ERROR_AUTH_FAILED); | |
| 459 SimulateGattConnectionError(device, BluetoothDevice::ERROR_FAILED); | 458 SimulateGattConnectionError(device, BluetoothDevice::ERROR_FAILED); |
|
scheib
2016/01/16 23:59:52
This test is intentionally sending 2 errors and ex
ortuno
2016/01/19 20:40:08
Done.
| |
| 460 EXPECT_EQ(BluetoothDevice::ERROR_AUTH_FAILED, last_connect_error_code_); | 459 EXPECT_EQ(BluetoothDevice::ERROR_FAILED, last_connect_error_code_); |
| 461 for (BluetoothGattConnection* connection : gatt_connections_) | 460 for (BluetoothGattConnection* connection : gatt_connections_) |
| 462 EXPECT_FALSE(connection->IsConnected()); | 461 EXPECT_FALSE(connection->IsConnected()); |
| 463 } | 462 } |
| 464 #endif // defined(OS_ANDROID) | 463 #endif // defined(OS_ANDROID) |
| 465 | 464 |
| 466 #if defined(OS_ANDROID) | 465 #if defined(OS_ANDROID) |
| 467 TEST_F(BluetoothTest, GattServices_ObserversCalls) { | 466 TEST_F(BluetoothTest, GattServices_ObserversCalls) { |
| 468 InitWithFakeAdapter(); | 467 InitWithFakeAdapter(); |
| 469 StartLowEnergyDiscoverySession(); | 468 StartLowEnergyDiscoverySession(); |
| 470 BluetoothDevice* device = DiscoverLowEnergyDevice(3); | 469 BluetoothDevice* device = DiscoverLowEnergyDevice(3); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 ResetEventCounts(); | 523 ResetEventCounts(); |
| 525 SimulateGattConnection(device); | 524 SimulateGattConnection(device); |
| 526 EXPECT_EQ(1, gatt_discovery_attempts_); | 525 EXPECT_EQ(1, gatt_discovery_attempts_); |
| 527 | 526 |
| 528 SimulateGattServicesDiscoveryError(device); | 527 SimulateGattServicesDiscoveryError(device); |
| 529 EXPECT_EQ(0u, device->GetGattServices().size()); | 528 EXPECT_EQ(0u, device->GetGattServices().size()); |
| 530 } | 529 } |
| 531 #endif // defined(OS_ANDROID) | 530 #endif // defined(OS_ANDROID) |
| 532 | 531 |
| 533 } // namespace device | 532 } // namespace device |
| OLD | NEW |