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

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

Issue 1382743002: bluetooth: Add characteristicvaluechanged event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-notifications-1
Patch Set: Address tkent's comments Created 5 years, 2 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 <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
31 // changed.
32 // TODO(ortuno): Remove the following 3 functions. This is a temporary hack to
33 // get layout tests working with Notifications.
34 // http://crbug.com/543884
35 void StartTestNotifications(MockBluetoothAdapter* adapter,
36 MockBluetoothGattCharacteristic* characteristic,
37 const std::vector<uint8_t>& value);
38 void StopTestNotifications();
39
26 private: 40 private:
41 void DoNotify(MockBluetoothAdapter* adapter,
42 MockBluetoothGattCharacteristic* characteristic,
43 const std::vector<uint8_t>& value);
44
45 base::RepeatingTimer test_notifications_timer_;
46
27 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattNotifySession); 47 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattNotifySession);
28 }; 48 };
29 49
30 } // namespace device 50 } // namespace device
31 51
32 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_ 52 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_NOTIFY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698