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

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

Issue 2241263005: Revert of Implement BluetoothGattNotifySession::Stop on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "device/bluetooth/bluetooth_gatt_notify_session.h" 15 #include "device/bluetooth/bluetooth_gatt_notify_session.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 17
18 namespace device { 18 namespace device {
19 19
20 class MockBluetoothAdapter; 20 class MockBluetoothAdapter;
21 class MockBluetoothGattCharacteristic; 21 class MockBluetoothGattCharacteristic;
22 22
23 class MockBluetoothGattNotifySession : public BluetoothGattNotifySession { 23 class MockBluetoothGattNotifySession : public BluetoothGattNotifySession {
24 public: 24 public:
25 explicit MockBluetoothGattNotifySession( 25 explicit MockBluetoothGattNotifySession(
26 base::WeakPtr<BluetoothRemoteGattCharacteristic> characteristic); 26 const std::string& characteristic_identifier);
27 virtual ~MockBluetoothGattNotifySession(); 27 virtual ~MockBluetoothGattNotifySession();
28 28
29 MOCK_CONST_METHOD0(GetCharacteristicIdentifier, std::string());
29 MOCK_METHOD0(IsActive, bool()); 30 MOCK_METHOD0(IsActive, bool());
30 MOCK_METHOD1(Stop, void(const base::Closure&)); 31 MOCK_METHOD1(Stop, void(const base::Closure&));
31 32
32 // Starts notifying the adapter's observers that the characteristic's value 33 // Starts notifying the adapter's observers that the characteristic's value
33 // changed. 34 // changed.
34 // TODO(ortuno): Remove the following 3 functions. This is a temporary hack to 35 // TODO(ortuno): Remove the following 3 functions. This is a temporary hack to
35 // get layout tests working with Notifications. 36 // get layout tests working with Notifications.
36 // http://crbug.com/543884 37 // http://crbug.com/543884
37 void StartTestNotifications(MockBluetoothAdapter* adapter, 38 void StartTestNotifications(MockBluetoothAdapter* adapter,
38 MockBluetoothGattCharacteristic* characteristic, 39 MockBluetoothGattCharacteristic* characteristic,
39 const std::vector<uint8_t>& value); 40 const std::vector<uint8_t>& value);
40 void StopTestNotifications(); 41 void StopTestNotifications();
41 42
42 private: 43 private:
43 void DoNotify(MockBluetoothAdapter* adapter, 44 void DoNotify(MockBluetoothAdapter* adapter,
44 MockBluetoothGattCharacteristic* characteristic, 45 MockBluetoothGattCharacteristic* characteristic,
45 const std::vector<uint8_t>& value); 46 const std::vector<uint8_t>& value);
46 47
47 base::RepeatingTimer test_notifications_timer_; 48 base::RepeatingTimer test_notifications_timer_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattNotifySession); 50 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattNotifySession);
50 }; 51 };
51 52
52 } // namespace device 53 } // namespace device
53 54
54 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ 55 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698