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

Side by Side Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 1232613004: The first 3 BluetoothTest.* unit tests now running on Mac as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movCBCM
Patch Set: pulling in origin/master so hopefully the patch will patch.. Created 5 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/bluetooth/bluetooth_adapter_mac.h"
6 #include "device/bluetooth/test/bluetooth_test_mac.h"
7 #include "device/bluetooth/test/mock_bluetooth_central_manager_mac.h"
8
9 namespace device {
10
11 BluetoothTestMac::BluetoothTestMac() {}
12
13 BluetoothTestMac::~BluetoothTestMac() {}
14
15 void BluetoothTestMac::SetUp() {}
16
17 void BluetoothTestMac::InitWithDefaultAdapter() {
18 ui_task_runner_ = new base::TestSimpleTaskRunner();
19 adapter_ =
20 BluetoothAdapterMac::CreateAdapterForTest("", "", ui_task_runner_).get();
scheib 2015/07/17 21:26:05 The intent of "InitWithDefaultAdapter" is to creat
krstnmnlsn 2015/07/17 23:14:50 So for some reason I thought there was a problem w
21 adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get());
22 }
23
24 void BluetoothTestMac::InitWithoutDefaultAdapter() {
25 ui_task_runner_ = new base::TestSimpleTaskRunner();
26 adapter_ =
27 BluetoothAdapterMac::CreateAdapterForTest("", "", ui_task_runner_).get();
28 adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get());
scheib 2015/07/17 21:26:05 Seems silly to static_cast. Have CreateAdapterForT
krstnmnlsn 2015/07/17 23:14:50 Done.
29
30 if (BluetoothAdapterMac::IsLowEnergyAvailable()) {
31 id low_energy_central_manager = [[MockCentralManager alloc] init];
32 [low_energy_central_manager setState:CBCentralManagerStateUnsupported];
33 adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager);
34 }
35 }
36
37 void BluetoothTestMac::InitWithFakeAdapter() {
38 ui_task_runner_ = new base::TestSimpleTaskRunner();
39 adapter_ = BluetoothAdapterMac::CreateAdapterForTest(
40 kTestAdapterName, kTestAdapterAddress, ui_task_runner_)
41 .get();
42 adapter_mac_ = static_cast<BluetoothAdapterMac*>(adapter_.get());
43
44 if (BluetoothAdapterMac::IsLowEnergyAvailable()) {
45 id low_energy_central_manager = [[MockCentralManager alloc] init];
46 [low_energy_central_manager setState:CBCentralManagerStatePoweredOn];
47 adapter_mac_->SetCentralManagerForTesting(low_energy_central_manager);
48 }
49 }
50
51 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698