Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ | 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/timer/timer.h" | |
| 11 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 12 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 13 | 14 |
| 14 namespace device { | 15 namespace device { |
| 15 | 16 |
| 17 class MockBluetoothAdapter; | |
| 18 class MockBluetoothGattCharacteristic; | |
| 19 | |
| 16 class MockBluetoothGattNotifySession : public BluetoothGattNotifySession { | 20 class MockBluetoothGattNotifySession : public BluetoothGattNotifySession { |
| 17 public: | 21 public: |
| 18 explicit MockBluetoothGattNotifySession( | 22 explicit MockBluetoothGattNotifySession( |
| 19 const std::string& characteristic_identifier); | 23 const std::string& characteristic_identifier); |
| 20 virtual ~MockBluetoothGattNotifySession(); | 24 virtual ~MockBluetoothGattNotifySession(); |
| 21 | 25 |
| 22 MOCK_CONST_METHOD0(GetCharacteristicIdentifier, std::string()); | 26 MOCK_CONST_METHOD0(GetCharacteristicIdentifier, std::string()); |
| 23 MOCK_METHOD0(IsActive, bool()); | 27 MOCK_METHOD0(IsActive, bool()); |
| 24 MOCK_METHOD1(Stop, void(const base::Closure&)); | 28 MOCK_METHOD1(Stop, void(const base::Closure&)); |
| 25 | 29 |
| 30 // Starts notifying the adapter's observers that the characteristic's value | |
|
scheib
2015/10/16 20:39:25
Timer concept is leaking outside of only Web Bluet
ortuno
2015/10/16 21:55:49
Done.
| |
| 31 // changed. | |
| 32 void StartTestNotifications(MockBluetoothAdapter* adapter, | |
| 33 MockBluetoothGattCharacteristic* characteristic, | |
| 34 const std::vector<uint8_t>& value); | |
| 35 void StopTestNotifications(); | |
| 36 | |
| 26 private: | 37 private: |
| 38 void DoNotify(MockBluetoothAdapter* adapter, | |
| 39 MockBluetoothGattCharacteristic* characteristic, | |
| 40 const std::vector<uint8_t>& value); | |
| 41 | |
| 42 base::RepeatingTimer test_notifications_timer_; | |
| 43 | |
| 27 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattNotifySession); | 44 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattNotifySession); |
| 28 }; | 45 }; |
| 29 | 46 |
| 30 } // namespace device | 47 } // namespace device |
| 31 | 48 |
| 32 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ | 49 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ |
| OLD | NEW |