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

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

Issue 1538173003: Implementing GATT connection/disconnect on OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip tests if Bluetooth Low Energy is not available Created 4 years, 9 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 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_
7 7
8 #include "base/memory/scoped_ptr.h"
8 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
9 #include "device/bluetooth/test/bluetooth_test.h" 10 #include "device/bluetooth/test/bluetooth_test.h"
10 11
11 namespace device { 12 namespace device {
12 13
13 class BluetoothAdapterMac; 14 class BluetoothAdapterMac;
14 15
15 // Mac implementation of BluetoothTestBase. 16 // Mac implementation of BluetoothTestBase.
16 class BluetoothTestMac : public BluetoothTestBase { 17 class BluetoothTestMac : public BluetoothTestBase {
17 public: 18 public:
18 static const std::string kTestPeripheralUUID1; 19 static const std::string kTestPeripheralUUID1;
19 static const std::string kTestPeripheralUUID2; 20 static const std::string kTestPeripheralUUID2;
20 21
21 BluetoothTestMac(); 22 BluetoothTestMac();
22 ~BluetoothTestMac() override; 23 ~BluetoothTestMac() override;
23 24
24 // Test overrides: 25 // Test overrides:
25 void SetUp() override; 26 void SetUp() override;
26 27
27 // BluetoothTestBase overrides: 28 // BluetoothTestBase overrides:
28 bool PlatformSupportsLowEnergy() override; 29 bool PlatformSupportsLowEnergy() override;
29 void InitWithDefaultAdapter() override; 30 void InitWithDefaultAdapter() override;
30 void InitWithoutDefaultAdapter() override; 31 void InitWithoutDefaultAdapter() override;
31 void InitWithFakeAdapter() override; 32 void InitWithFakeAdapter() override;
32 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; 33 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override;
34 void SimulateGattConnection(BluetoothDevice* device) override;
35 void SimulateGattDisconnection(BluetoothDevice* device) override;
36 void SimulateGattConnectionError(
37 BluetoothDevice* device,
38 BluetoothDevice::ConnectErrorCode errorCode) override;
39
40 // Callback for the bluetooth central manager mock.
41 void OnFakeBluetoothDeviceConnectGattCalled();
42 void OnFakeBluetoothGattDisconnect();
33 43
34 protected: 44 protected:
45 class ScopedMockCentralManager;
46
35 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. 47 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes.
36 std::string FindCBUUIDForHashTarget(); 48 std::string FindCBUUIDForHashTarget();
37 49
38 BluetoothAdapterMac* adapter_mac_ = NULL; 50 BluetoothAdapterMac* adapter_mac_ = NULL;
51 scoped_ptr<ScopedMockCentralManager> mock_central_manager_;
39 }; 52 };
40 53
41 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). 54 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName).
42 typedef BluetoothTestMac BluetoothTest; 55 typedef BluetoothTestMac BluetoothTest;
43 56
44 } // namespace device 57 } // namespace device
45 58
46 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ 59 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.mm ('k') | device/bluetooth/test/bluetooth_test_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698