OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DEVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ |
6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ | 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 MockBluetoothDevice(MockBluetoothAdapter* adapter, | 27 MockBluetoothDevice(MockBluetoothAdapter* adapter, |
28 uint32_t bluetooth_class, | 28 uint32_t bluetooth_class, |
29 const std::string& name, | 29 const std::string& name, |
30 const std::string& address, | 30 const std::string& address, |
31 bool paired, | 31 bool paired, |
32 bool connected); | 32 bool connected); |
33 virtual ~MockBluetoothDevice(); | 33 virtual ~MockBluetoothDevice(); |
34 | 34 |
35 MOCK_CONST_METHOD0(GetBluetoothClass, uint32_t()); | 35 MOCK_CONST_METHOD0(GetBluetoothClass, uint32_t()); |
36 MOCK_CONST_METHOD0(GetDeviceName, std::string()); | |
37 MOCK_CONST_METHOD0(GetIdentifier, std::string()); | 36 MOCK_CONST_METHOD0(GetIdentifier, std::string()); |
38 MOCK_CONST_METHOD0(GetAddress, std::string()); | 37 MOCK_CONST_METHOD0(GetAddress, std::string()); |
39 MOCK_CONST_METHOD0(GetVendorIDSource, BluetoothDevice::VendorIDSource()); | 38 MOCK_CONST_METHOD0(GetVendorIDSource, BluetoothDevice::VendorIDSource()); |
40 MOCK_CONST_METHOD0(GetVendorID, uint16_t()); | 39 MOCK_CONST_METHOD0(GetVendorID, uint16_t()); |
41 MOCK_CONST_METHOD0(GetProductID, uint16_t()); | 40 MOCK_CONST_METHOD0(GetProductID, uint16_t()); |
42 MOCK_CONST_METHOD0(GetDeviceID, uint16_t()); | 41 MOCK_CONST_METHOD0(GetDeviceID, uint16_t()); |
43 MOCK_CONST_METHOD0(GetName, base::string16()); | 42 MOCK_CONST_METHOD0(GetAppearance, uint16_t()); |
| 43 MOCK_CONST_METHOD0(GetNameForDisplay, base::string16()); |
44 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType()); | 44 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType()); |
45 MOCK_CONST_METHOD0(GetAppearance, uint16_t()); | |
46 MOCK_CONST_METHOD0(IsPaired, bool()); | 45 MOCK_CONST_METHOD0(IsPaired, bool()); |
47 MOCK_CONST_METHOD0(IsConnected, bool()); | 46 MOCK_CONST_METHOD0(IsConnected, bool()); |
48 MOCK_CONST_METHOD0(IsGattConnected, bool()); | 47 MOCK_CONST_METHOD0(IsGattConnected, bool()); |
49 MOCK_CONST_METHOD0(IsConnectable, bool()); | 48 MOCK_CONST_METHOD0(IsConnectable, bool()); |
50 MOCK_CONST_METHOD0(IsConnecting, bool()); | 49 MOCK_CONST_METHOD0(IsConnecting, bool()); |
51 MOCK_CONST_METHOD0(GetUUIDs, UUIDList()); | 50 MOCK_CONST_METHOD0(GetUUIDs, UUIDList()); |
52 MOCK_CONST_METHOD0(GetInquiryRSSI, int16_t()); | 51 MOCK_CONST_METHOD0(GetInquiryRSSI, int16_t()); |
53 MOCK_CONST_METHOD0(GetInquiryTxPower, int16_t()); | 52 MOCK_CONST_METHOD0(GetInquiryTxPower, int16_t()); |
54 MOCK_CONST_METHOD0(ExpectingPinCode, bool()); | 53 MOCK_CONST_METHOD0(ExpectingPinCode, bool()); |
55 MOCK_CONST_METHOD0(ExpectingPasskey, bool()); | 54 MOCK_CONST_METHOD0(ExpectingPasskey, bool()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void(const GattConnectionCallback& callback, | 87 void(const GattConnectionCallback& callback, |
89 const ConnectErrorCallback& error_callback)); | 88 const ConnectErrorCallback& error_callback)); |
90 | 89 |
91 MOCK_METHOD1(SetGattServicesDiscoveryComplete, void(bool)); | 90 MOCK_METHOD1(SetGattServicesDiscoveryComplete, void(bool)); |
92 MOCK_CONST_METHOD0(IsGattServicesDiscoveryComplete, bool()); | 91 MOCK_CONST_METHOD0(IsGattServicesDiscoveryComplete, bool()); |
93 | 92 |
94 MOCK_CONST_METHOD0(GetGattServices, | 93 MOCK_CONST_METHOD0(GetGattServices, |
95 std::vector<BluetoothRemoteGattService*>()); | 94 std::vector<BluetoothRemoteGattService*>()); |
96 MOCK_CONST_METHOD1(GetGattService, | 95 MOCK_CONST_METHOD1(GetGattService, |
97 BluetoothRemoteGattService*(const std::string&)); | 96 BluetoothRemoteGattService*(const std::string&)); |
| 97 MOCK_CONST_METHOD0(GetDeviceName, std::string()); |
98 MOCK_METHOD0(CreateGattConnectionImpl, void()); | 98 MOCK_METHOD0(CreateGattConnectionImpl, void()); |
99 MOCK_METHOD0(DisconnectGatt, void()); | 99 MOCK_METHOD0(DisconnectGatt, void()); |
100 | 100 |
101 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. | 101 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. |
102 // This method takes ownership of the MockBluetoothGATTServices. This is only | 102 // This method takes ownership of the MockBluetoothGATTServices. This is only |
103 // for convenience as far as testing is concerned, and it's possible to write | 103 // for convenience as far as testing is concerned, and it's possible to write |
104 // test cases without using these functions. | 104 // test cases without using these functions. |
105 // Example: | 105 // Example: |
106 // ON_CALL(*mock_device, GetGattServices)) | 106 // ON_CALL(*mock_device, GetGattServices)) |
107 // .WillByDefault(Invoke(*mock_device, | 107 // .WillByDefault(Invoke(*mock_device, |
(...skipping 11 matching lines...) Expand all Loading... |
119 std::string address_; | 119 std::string address_; |
120 BluetoothDevice::UUIDList uuids_; | 120 BluetoothDevice::UUIDList uuids_; |
121 bool connected_; | 121 bool connected_; |
122 | 122 |
123 ScopedVector<MockBluetoothGattService> mock_services_; | 123 ScopedVector<MockBluetoothGattService> mock_services_; |
124 }; | 124 }; |
125 | 125 |
126 } // namespace device | 126 } // namespace device |
127 | 127 |
128 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ | 128 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ |
OLD | NEW |