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

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: remove useless TransportMask 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";
(...skipping 21 matching lines...) Expand all
45 46
46 BluetoothTestBase::NotificationType::~NotificationType() {} 47 BluetoothTestBase::NotificationType::~NotificationType() {}
47 48
48 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} 49 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {}
49 50
50 BluetoothTestBase::~BluetoothTestBase() { 51 BluetoothTestBase::~BluetoothTestBase() {
51 } 52 }
52 53
53 void BluetoothTestBase::StartLowEnergyDiscoverySession() { 54 void BluetoothTestBase::StartLowEnergyDiscoverySession() {
54 adapter_->StartDiscoverySessionWithFilter( 55 adapter_->StartDiscoverySessionWithFilter(
55 base::WrapUnique(new BluetoothDiscoveryFilter( 56 base::WrapUnique(new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)),
56 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)),
57 GetDiscoverySessionCallback(Call::EXPECTED), 57 GetDiscoverySessionCallback(Call::EXPECTED),
58 GetErrorCallback(Call::NOT_EXPECTED)); 58 GetErrorCallback(Call::NOT_EXPECTED));
59 base::RunLoop().RunUntilIdle(); 59 base::RunLoop().RunUntilIdle();
60 } 60 }
61 61
62 void BluetoothTestBase::StartLowEnergyDiscoverySessionExpectedToFail() { 62 void BluetoothTestBase::StartLowEnergyDiscoverySessionExpectedToFail() {
63 adapter_->StartDiscoverySessionWithFilter( 63 adapter_->StartDiscoverySessionWithFilter(
64 base::WrapUnique(new BluetoothDiscoveryFilter( 64 base::WrapUnique(new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)),
65 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)),
66 GetDiscoverySessionCallback(Call::NOT_EXPECTED), 65 GetDiscoverySessionCallback(Call::NOT_EXPECTED),
67 GetErrorCallback(Call::EXPECTED)); 66 GetErrorCallback(Call::EXPECTED));
68 base::RunLoop().RunUntilIdle(); 67 base::RunLoop().RunUntilIdle();
69 } 68 }
70 69
71 void BluetoothTestBase::TearDown() { 70 void BluetoothTestBase::TearDown() {
72 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_); 71 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_);
73 EXPECT_EQ(expected_error_callback_calls_, actual_error_callback_calls_); 72 EXPECT_EQ(expected_error_callback_calls_, actual_error_callback_calls_);
74 EXPECT_FALSE(unexpected_success_callback_); 73 EXPECT_FALSE(unexpected_success_callback_);
75 EXPECT_FALSE(unexpected_error_callback_); 74 EXPECT_FALSE(unexpected_error_callback_);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 gatt_disconnection_attempts_ = 0; 332 gatt_disconnection_attempts_ = 0;
334 gatt_discovery_attempts_ = 0; 333 gatt_discovery_attempts_ = 0;
335 gatt_notify_characteristic_attempts_ = 0; 334 gatt_notify_characteristic_attempts_ = 0;
336 gatt_read_characteristic_attempts_ = 0; 335 gatt_read_characteristic_attempts_ = 0;
337 gatt_write_characteristic_attempts_ = 0; 336 gatt_write_characteristic_attempts_ = 0;
338 gatt_read_descriptor_attempts_ = 0; 337 gatt_read_descriptor_attempts_ = 0;
339 gatt_write_descriptor_attempts_ = 0; 338 gatt_write_descriptor_attempts_ = 0;
340 } 339 }
341 340
342 } // namespace device 341 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698