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

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

Issue 1394973003: bluetooth: android: Create BluetoothRemoteGattServiceAndroid objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-renames-
Patch Set: Address ortuno Created 5 years, 2 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 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 "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 SimulateGattConnectionError(device, BluetoothDevice::ERROR_AUTH_FAILED); 418 SimulateGattConnectionError(device, BluetoothDevice::ERROR_AUTH_FAILED);
419 SimulateGattConnectionError(device, BluetoothDevice::ERROR_FAILED); 419 SimulateGattConnectionError(device, BluetoothDevice::ERROR_FAILED);
420 EXPECT_EQ(0, callback_count_); 420 EXPECT_EQ(0, callback_count_);
421 EXPECT_EQ(1, error_callback_count_); 421 EXPECT_EQ(1, error_callback_count_);
422 EXPECT_EQ(BluetoothDevice::ERROR_AUTH_FAILED, last_connect_error_code_); 422 EXPECT_EQ(BluetoothDevice::ERROR_AUTH_FAILED, last_connect_error_code_);
423 for (BluetoothGattConnection* connection : gatt_connections_) 423 for (BluetoothGattConnection* connection : gatt_connections_)
424 EXPECT_FALSE(connection->IsConnected()); 424 EXPECT_FALSE(connection->IsConnected());
425 } 425 }
426 #endif // defined(OS_ANDROID) 426 #endif // defined(OS_ANDROID)
427 427
428 #if defined(OS_ANDROID)
429 TEST_F(BluetoothTest, SimulateGattServicesDiscovered) {
430 InitWithFakeAdapter();
431 StartDiscoverySession();
432 BluetoothDevice* device = DiscoverLowEnergyDevice(3);
433 device->CreateGattConnection(GetGattConnectionCallback(),
434 GetConnectErrorCallback());
435 ResetEventCounts();
436 SimulateGattConnection(device);
437 EXPECT_EQ(1, gatt_discovery_attempts_);
438
439 // TODO(scheib): Add more control over how many services are created and
440 // their properties. http://crbug.com/541400
441 SimulateGattServicesDiscovered(device);
442 EXPECT_EQ(2u, device->GetGattServices().size());
443 }
444 #endif // defined(OS_ANDROID)
445
446 #if defined(OS_ANDROID)
447 TEST_F(BluetoothTest, SimulateGattServicesDiscoveryError) {
448 InitWithFakeAdapter();
449 StartDiscoverySession();
450 BluetoothDevice* device = DiscoverLowEnergyDevice(3);
451 device->CreateGattConnection(GetGattConnectionCallback(),
452 GetConnectErrorCallback());
453 ResetEventCounts();
454 SimulateGattConnection(device);
455 EXPECT_EQ(1, gatt_discovery_attempts_);
456
457 SimulateGattServicesDiscoveryError(device);
458 EXPECT_EQ(0u, device->GetGattServices().size());
459 }
460 #endif // defined(OS_ANDROID)
461
428 } // namespace device 462 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_android.cc ('k') | device/bluetooth/bluetooth_remote_gatt_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698