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

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

Issue 2063353002: device/bluetooth: split out transport enum (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing new use in components/arc/bluetooth Created 4 years, 6 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/bluetooth_test.h" 5 #include "device/bluetooth/test/bluetooth_test.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "device/bluetooth/bluetooth_adapter.h" 13 #include "device/bluetooth/bluetooth_adapter.h"
14 #include "device/bluetooth/bluetooth_common.h"
14 15
15 namespace device { 16 namespace device {
16 17
17 const std::string BluetoothTestBase::kTestAdapterName = "FakeBluetoothAdapter"; 18 const std::string BluetoothTestBase::kTestAdapterName = "FakeBluetoothAdapter";
18 const std::string BluetoothTestBase::kTestAdapterAddress = "A1:B2:C3:D4:E5:F6"; 19 const std::string BluetoothTestBase::kTestAdapterAddress = "A1:B2:C3:D4:E5:F6";
19 20
20 const std::string BluetoothTestBase::kTestDeviceName = "FakeBluetoothDevice"; 21 const std::string BluetoothTestBase::kTestDeviceName = "FakeBluetoothDevice";
21 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; 22 const std::string BluetoothTestBase::kTestDeviceNameEmpty = "";
22 23
23 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; 24 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE";
24 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; 25 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63";
25 26
26 const std::string BluetoothTestBase::kTestUUIDGenericAccess = "1800"; 27 const std::string BluetoothTestBase::kTestUUIDGenericAccess = "1800";
27 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = "1801"; 28 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = "1801";
28 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = "1802"; 29 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = "1802";
29 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803"; 30 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803";
30 31
31 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} 32 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {}
32 33
33 BluetoothTestBase::~BluetoothTestBase() { 34 BluetoothTestBase::~BluetoothTestBase() {
34 } 35 }
35 36
36 void BluetoothTestBase::StartLowEnergyDiscoverySession() { 37 void BluetoothTestBase::StartLowEnergyDiscoverySession() {
37 adapter_->StartDiscoverySessionWithFilter( 38 adapter_->StartDiscoverySessionWithFilter(
38 base::WrapUnique(new BluetoothDiscoveryFilter( 39 base::WrapUnique(new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)),
39 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)),
40 GetDiscoverySessionCallback(Call::EXPECTED), 40 GetDiscoverySessionCallback(Call::EXPECTED),
41 GetErrorCallback(Call::NOT_EXPECTED)); 41 GetErrorCallback(Call::NOT_EXPECTED));
42 base::RunLoop().RunUntilIdle(); 42 base::RunLoop().RunUntilIdle();
43 } 43 }
44 44
45 void BluetoothTestBase::StartLowEnergyDiscoverySessionExpectedToFail() { 45 void BluetoothTestBase::StartLowEnergyDiscoverySessionExpectedToFail() {
46 adapter_->StartDiscoverySessionWithFilter( 46 adapter_->StartDiscoverySessionWithFilter(
47 base::WrapUnique(new BluetoothDiscoveryFilter( 47 base::WrapUnique(new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)),
48 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)),
49 GetDiscoverySessionCallback(Call::NOT_EXPECTED), 48 GetDiscoverySessionCallback(Call::NOT_EXPECTED),
50 GetErrorCallback(Call::EXPECTED)); 49 GetErrorCallback(Call::EXPECTED));
51 base::RunLoop().RunUntilIdle(); 50 base::RunLoop().RunUntilIdle();
52 } 51 }
53 52
54 void BluetoothTestBase::TearDown() { 53 void BluetoothTestBase::TearDown() {
55 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_); 54 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_);
56 EXPECT_EQ(expected_error_callback_calls_, actual_error_callback_calls_); 55 EXPECT_EQ(expected_error_callback_calls_, actual_error_callback_calls_);
57 EXPECT_FALSE(unexpected_success_callback_); 56 EXPECT_FALSE(unexpected_success_callback_);
58 EXPECT_FALSE(unexpected_error_callback_); 57 EXPECT_FALSE(unexpected_error_callback_);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 gatt_disconnection_attempts_ = 0; 314 gatt_disconnection_attempts_ = 0;
316 gatt_discovery_attempts_ = 0; 315 gatt_discovery_attempts_ = 0;
317 gatt_notify_characteristic_attempts_ = 0; 316 gatt_notify_characteristic_attempts_ = 0;
318 gatt_read_characteristic_attempts_ = 0; 317 gatt_read_characteristic_attempts_ = 0;
319 gatt_write_characteristic_attempts_ = 0; 318 gatt_write_characteristic_attempts_ = 0;
320 gatt_read_descriptor_attempts_ = 0; 319 gatt_read_descriptor_attempts_ = 0;
321 gatt_write_descriptor_attempts_ = 0; 320 gatt_write_descriptor_attempts_ = 0;
322 } 321 }
323 322
324 } // namespace device 323 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698