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

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

Issue 1156573005: bluetooth: Browser-side implementation of getCharacteristic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-get-primary-service-initial
Patch Set: Use iterator Created 5 years, 6 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_SERVICE_H_ 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_SERVICE_H_
6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_SERVICE_H_ 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_vector.h"
11 #include "device/bluetooth/bluetooth_gatt_service.h" 12 #include "device/bluetooth/bluetooth_gatt_service.h"
12 #include "device/bluetooth/bluetooth_uuid.h" 13 #include "device/bluetooth/bluetooth_uuid.h"
14 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h"
13 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
14 16
15 namespace device { 17 namespace device {
16 18
17 class BluetoothGattCharacteristic; 19 class BluetoothGattCharacteristic;
18 class MockBluetoothDevice; 20 class MockBluetoothDevice;
19 21
20 class MockBluetoothGattService : public BluetoothGattService { 22 class MockBluetoothGattService : public BluetoothGattService {
21 public: 23 public:
22 MockBluetoothGattService(MockBluetoothDevice* device, 24 MockBluetoothGattService(MockBluetoothDevice* device,
(...skipping 11 matching lines...) Expand all
34 MOCK_CONST_METHOD0(GetCharacteristics, 36 MOCK_CONST_METHOD0(GetCharacteristics,
35 std::vector<BluetoothGattCharacteristic*>()); 37 std::vector<BluetoothGattCharacteristic*>());
36 MOCK_CONST_METHOD0(GetIncludedServices, std::vector<BluetoothGattService*>()); 38 MOCK_CONST_METHOD0(GetIncludedServices, std::vector<BluetoothGattService*>());
37 MOCK_CONST_METHOD1(GetCharacteristic, 39 MOCK_CONST_METHOD1(GetCharacteristic,
38 BluetoothGattCharacteristic*(const std::string&)); 40 BluetoothGattCharacteristic*(const std::string&));
39 MOCK_METHOD1(AddCharacteristic, bool(BluetoothGattCharacteristic*)); 41 MOCK_METHOD1(AddCharacteristic, bool(BluetoothGattCharacteristic*));
40 MOCK_METHOD1(AddIncludedService, bool(BluetoothGattService*)); 42 MOCK_METHOD1(AddIncludedService, bool(BluetoothGattService*));
41 MOCK_METHOD2(Register, void(const base::Closure&, const ErrorCallback&)); 43 MOCK_METHOD2(Register, void(const base::Closure&, const ErrorCallback&));
42 MOCK_METHOD2(Unregister, void(const base::Closure&, const ErrorCallback&)); 44 MOCK_METHOD2(Unregister, void(const base::Closure&, const ErrorCallback&));
43 45
46 // BluetoothService manages the lifetime of its BluetoothGATTCharacteristics.
scheib 2015/06/04 06:30:49 BluetoothGATTService
ortuno 2015/06/05 19:37:44 Done.
47 // This methods takes ownership of the BluetoothGATTCharacteristics. This is
scheib 2015/06/04 06:30:49 "of the Mock____" Fix the adapter and device comme
ortuno 2015/06/05 19:37:44 Done.
48 // only for convenience as far as testing is concerned, and it's possible to
49 // write test cases without using these functions.
50 // Example:
51 // ON_CALL(*mock_service, GetCharacteristics))
52 // .WillByDefault(Invoke(
53 // *mock_service,
54 // &MockBluetoothGattService::GetMockCharacteristics));
55 void AddMockCharacteristic(
56 scoped_ptr<MockBluetoothGattCharacteristic> mock_characteristic);
57 std::vector<BluetoothGattCharacteristic*> GetMockCharacteristics() const;
58
44 private: 59 private:
60 ScopedVector<MockBluetoothGattCharacteristic> mock_characteristics_;
61
45 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattService); 62 DISALLOW_COPY_AND_ASSIGN(MockBluetoothGattService);
46 }; 63 };
47 64
48 } // namespace device 65 } // namespace device
49 66
50 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_SERVICE_H_ 67 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_GATT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698