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

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

Issue 2798193002: Use test UUIDs for device bluetooth unit tests (Closed)
Patch Set: address comments Created 3 years, 8 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
« no previous file with comments | « device/bluetooth/test/bluetooth_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "device/bluetooth/bluetooth_common.h"
15 15
16 namespace device { 16 namespace device {
17 17
18 const std::string BluetoothTestBase::kTestAdapterName = "FakeBluetoothAdapter"; 18 const std::string BluetoothTestBase::kTestAdapterName = "FakeBluetoothAdapter";
19 const std::string BluetoothTestBase::kTestAdapterAddress = "A1:B2:C3:D4:E5:F6"; 19 const std::string BluetoothTestBase::kTestAdapterAddress = "A1:B2:C3:D4:E5:F6";
20 20
21 const std::string BluetoothTestBase::kTestDeviceName = "FakeBluetoothDevice"; 21 const std::string BluetoothTestBase::kTestDeviceName = "FakeBluetoothDevice";
22 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; 22 const std::string BluetoothTestBase::kTestDeviceNameEmpty = "";
23 23
24 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; 24 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE";
25 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; 25 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63";
26 const std::string BluetoothTestBase::kTestDeviceAddress3 = "03:00:00:17:C0:57"; 26 const std::string BluetoothTestBase::kTestDeviceAddress3 = "03:00:00:17:C0:57";
27 27
28 // Service UUIDs
28 const std::string BluetoothTestBase::kTestUUIDGenericAccess = 29 const std::string BluetoothTestBase::kTestUUIDGenericAccess =
29 "00001800-0000-1000-8000-00805f9b34fb"; 30 "00001800-0000-1000-8000-00805f9b34fb";
30 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = 31 const std::string BluetoothTestBase::kTestUUIDGenericAttribute =
31 "00001801-0000-1000-8000-00805f9b34fb"; 32 "00001801-0000-1000-8000-00805f9b34fb";
32 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = 33 const std::string BluetoothTestBase::kTestUUIDImmediateAlert =
33 "00001802-0000-1000-8000-00805f9b34fb"; 34 "00001802-0000-1000-8000-00805f9b34fb";
34 const std::string BluetoothTestBase::kTestUUIDLinkLoss = 35 const std::string BluetoothTestBase::kTestUUIDLinkLoss =
35 "00001803-0000-1000-8000-00805f9b34fb"; 36 "00001803-0000-1000-8000-00805f9b34fb";
36 const std::string BluetoothTestBase::kTestUUIDHeartRate = 37 const std::string BluetoothTestBase::kTestUUIDHeartRate =
37 "0000180d-0000-1000-8000-00805f9b34fb"; 38 "0000180d-0000-1000-8000-00805f9b34fb";
39 // Characteristic UUIDs
40 const std::string BluetoothTestBase::kTestUUIDDeviceName =
41 "00002a00-0000-1000-8000-00805f9b34fb";
42 const std::string BluetoothTestBase::kTestUUIDAppearance =
43 "00002a01-0000-1000-8000-00805f9b34fb";
44 const std::string BluetoothTestBase::kTestUUIDReconnectionAddress =
45 "00002a03-0000-1000-8000-00805f9b34fb";
46 const std::string BluetoothTestBase::kTestUUIDHeartRateMeasurement =
47 "00002a37-0000-1000-8000-00805f9b34fb";
48 // Descriptor UUIDs
49 const std::string BluetoothTestBase::kTestUUIDCharacteristicUserDescription =
50 "00002901-0000-1000-8000-00805f9b34fb";
51 const std::string
52 BluetoothTestBase::kTestUUIDClientCharacteristicConfiguration =
53 "00002902-0000-1000-8000-00805f9b34fb";
54 const std::string
55 BluetoothTestBase::kTestUUIDServerCharacteristicConfiguration =
56 "00002903-0000-1000-8000-00805f9b34fb";
57 const std::string BluetoothTestBase::kTestUUIDCharacteristicPresentationFormat =
58 "00002904-0000-1000-8000-00805f9b34fb";
38 59
39 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} 60 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {}
40 61
41 BluetoothTestBase::~BluetoothTestBase() { 62 BluetoothTestBase::~BluetoothTestBase() {
42 } 63 }
43 64
44 void BluetoothTestBase::StartLowEnergyDiscoverySession() { 65 void BluetoothTestBase::StartLowEnergyDiscoverySession() {
45 adapter_->StartDiscoverySessionWithFilter( 66 adapter_->StartDiscoverySessionWithFilter(
46 base::MakeUnique<BluetoothDiscoveryFilter>(BLUETOOTH_TRANSPORT_LE), 67 base::MakeUnique<BluetoothDiscoveryFilter>(BLUETOOTH_TRANSPORT_LE),
47 GetDiscoverySessionCallback(Call::EXPECTED), 68 GetDiscoverySessionCallback(Call::EXPECTED),
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 gatt_write_characteristic_attempts_ = 0; 424 gatt_write_characteristic_attempts_ = 0;
404 gatt_read_descriptor_attempts_ = 0; 425 gatt_read_descriptor_attempts_ = 0;
405 gatt_write_descriptor_attempts_ = 0; 426 gatt_write_descriptor_attempts_ = 0;
406 } 427 }
407 428
408 void BluetoothTestBase::RemoveTimedOutDevices() { 429 void BluetoothTestBase::RemoveTimedOutDevices() {
409 adapter_->RemoveTimedOutDevices(); 430 adapter_->RemoveTimedOutDevices();
410 } 431 }
411 432
412 } // namespace device 433 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/test/bluetooth_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698