OLD | NEW |
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_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "device/bluetooth/bluetooth_adapter.h" | 10 #include "device/bluetooth/bluetooth_adapter.h" |
11 #include "device/bluetooth/bluetooth_discovery_session.h" | 11 #include "device/bluetooth/bluetooth_discovery_session.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace device { | 14 namespace device { |
15 | 15 |
16 class BluetoothAdapter; | 16 class BluetoothAdapter; |
17 | 17 |
18 // A test fixture for Bluetooth that abstracts platform specifics for creating | 18 // A test fixture for Bluetooth that abstracts platform specifics for creating |
19 // and controlling fake low level objects. | 19 // and controlling fake low level objects. |
20 // | 20 // |
21 // Subclasses on each platform implement this, and are then typedef-ed to | 21 // Subclasses on each platform implement this, and are then typedef-ed to |
22 // BluetoothTest. | 22 // BluetoothTest. |
23 class BluetoothTestBase : public testing::Test { | 23 class BluetoothTestBase : public testing::Test { |
24 public: | 24 public: |
| 25 static const std::string kTestAdapterName; |
| 26 static const std::string kTestAdapterAddress; |
| 27 |
25 BluetoothTestBase(); | 28 BluetoothTestBase(); |
26 ~BluetoothTestBase() override; | 29 ~BluetoothTestBase() override; |
27 | 30 |
28 // Initializes the BluetoothAdapter |adapter_| with the system adapter. | 31 // Initializes the BluetoothAdapter |adapter_| with the system adapter. |
29 virtual void InitWithDefaultAdapter(){}; | 32 virtual void InitWithDefaultAdapter(){}; |
30 | 33 |
31 // Initializes the BluetoothAdapter |adapter_| with the system adapter forced | 34 // Initializes the BluetoothAdapter |adapter_| with the system adapter forced |
32 // to be ignored as if it did not exist. This enables tests for when an | 35 // to be ignored as if it did not exist. This enables tests for when an |
33 // adapter is not present on the system. | 36 // adapter is not present on the system. |
34 virtual void InitWithoutDefaultAdapter(){}; | 37 virtual void InitWithoutDefaultAdapter(){}; |
(...skipping 27 matching lines...) Expand all Loading... |
62 scoped_refptr<BluetoothAdapter> adapter_; | 65 scoped_refptr<BluetoothAdapter> adapter_; |
63 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; | 66 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; |
64 int callback_count_ = 0; | 67 int callback_count_ = 0; |
65 int error_callback_count_ = 0; | 68 int error_callback_count_ = 0; |
66 bool run_message_loop_to_wait_for_callbacks_ = true; | 69 bool run_message_loop_to_wait_for_callbacks_ = true; |
67 }; | 70 }; |
68 | 71 |
69 } // namespace device | 72 } // namespace device |
70 | 73 |
71 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 74 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
OLD | NEW |