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

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

Issue 1884033002: Implement BluetoothTestBlueZ and enable some LE tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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_bluez.cc ('k') | device/device_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_win.h" 5 #include "device/bluetooth/test/bluetooth_test_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 BluetoothDevice* BluetoothTestWin::DiscoverLowEnergyDevice(int device_ordinal) { 129 BluetoothDevice* BluetoothTestWin::DiscoverLowEnergyDevice(int device_ordinal) {
130 if (device_ordinal > 4 || device_ordinal < 1) 130 if (device_ordinal > 4 || device_ordinal < 1)
131 return nullptr; 131 return nullptr;
132 132
133 std::string device_name = kTestDeviceName; 133 std::string device_name = kTestDeviceName;
134 std::string device_address = kTestDeviceAddress1; 134 std::string device_address = kTestDeviceAddress1;
135 std::string service_uuid_1; 135 std::string service_uuid_1;
136 std::string service_uuid_2; 136 std::string service_uuid_2;
137 137
138 switch (device_ordinal) { 138 switch (device_ordinal) {
139 case 1: { 139 case 1:
140 service_uuid_1 = kTestUUIDGenericAccess; 140 service_uuid_1 = kTestUUIDGenericAccess;
141 service_uuid_2 = kTestUUIDGenericAttribute; 141 service_uuid_2 = kTestUUIDGenericAttribute;
142 } break; 142 break;
143 case 2: { 143 case 2:
144 service_uuid_1 = kTestUUIDImmediateAlert; 144 service_uuid_1 = kTestUUIDImmediateAlert;
145 service_uuid_2 = kTestUUIDLinkLoss; 145 service_uuid_2 = kTestUUIDLinkLoss;
146 } break; 146 break;
147 case 3: { 147 case 3:
148 device_name = kTestDeviceNameEmpty; 148 device_name = kTestDeviceNameEmpty;
149 } break; 149 break;
150 case 4: { 150 case 4:
151 device_name = kTestDeviceNameEmpty; 151 device_name = kTestDeviceNameEmpty;
152 device_address = kTestDeviceAddress2; 152 device_address = kTestDeviceAddress2;
153 } break; 153 break;
154 } 154 }
155 155
156 win::BLEDevice* simulated_device = fake_bt_le_wrapper_->SimulateBLEDevice( 156 win::BLEDevice* simulated_device = fake_bt_le_wrapper_->SimulateBLEDevice(
157 device_name, CanonicalStringToBLUETOOTH_ADDRESS(device_address)); 157 device_name, CanonicalStringToBLUETOOTH_ADDRESS(device_address));
158 if (simulated_device != nullptr) { 158 if (simulated_device != nullptr) {
159 if (!service_uuid_1.empty()) { 159 if (!service_uuid_1.empty()) {
160 fake_bt_le_wrapper_->SimulateGattService( 160 fake_bt_le_wrapper_->SimulateGattService(
161 simulated_device, nullptr, 161 simulated_device, nullptr,
162 CanonicalStringToBTH_LE_UUID(service_uuid_1)); 162 CanonicalStringToBTH_LE_UUID(service_uuid_1));
163 } 163 }
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 void BluetoothTestWin::ForceRefreshDevice() { 484 void BluetoothTestWin::ForceRefreshDevice() {
485 adapter_win_->force_update_device_for_test_ = true; 485 adapter_win_->force_update_device_for_test_ = true;
486 FinishPendingTasks(); 486 FinishPendingTasks();
487 } 487 }
488 488
489 void BluetoothTestWin::FinishPendingTasks() { 489 void BluetoothTestWin::FinishPendingTasks() {
490 bluetooth_task_runner_->RunPendingTasks(); 490 bluetooth_task_runner_->RunPendingTasks();
491 base::RunLoop().RunUntilIdle(); 491 base::RunLoop().RunUntilIdle();
492 } 492 }
493 } 493 }
OLDNEW
« no previous file with comments | « device/bluetooth/test/bluetooth_test_bluez.cc ('k') | device/device_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698