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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 MOCK_CONST_METHOD0(GetIdentifier, std::string()); | 34 MOCK_CONST_METHOD0(GetIdentifier, std::string()); |
35 MOCK_CONST_METHOD0(GetAddress, std::string()); | 35 MOCK_CONST_METHOD0(GetAddress, std::string()); |
36 MOCK_CONST_METHOD0(GetVendorIDSource, BluetoothDevice::VendorIDSource()); | 36 MOCK_CONST_METHOD0(GetVendorIDSource, BluetoothDevice::VendorIDSource()); |
37 MOCK_CONST_METHOD0(GetVendorID, uint16()); | 37 MOCK_CONST_METHOD0(GetVendorID, uint16()); |
38 MOCK_CONST_METHOD0(GetProductID, uint16()); | 38 MOCK_CONST_METHOD0(GetProductID, uint16()); |
39 MOCK_CONST_METHOD0(GetDeviceID, uint16()); | 39 MOCK_CONST_METHOD0(GetDeviceID, uint16()); |
40 MOCK_CONST_METHOD0(GetName, base::string16()); | 40 MOCK_CONST_METHOD0(GetName, base::string16()); |
41 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType()); | 41 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType()); |
42 MOCK_CONST_METHOD0(IsPaired, bool()); | 42 MOCK_CONST_METHOD0(IsPaired, bool()); |
43 MOCK_CONST_METHOD0(IsConnected, bool()); | 43 MOCK_CONST_METHOD0(IsConnected, bool()); |
| 44 MOCK_CONST_METHOD0(IsGattConnected, bool()); |
44 MOCK_CONST_METHOD0(IsConnectable, bool()); | 45 MOCK_CONST_METHOD0(IsConnectable, bool()); |
45 MOCK_CONST_METHOD0(IsConnecting, bool()); | 46 MOCK_CONST_METHOD0(IsConnecting, bool()); |
46 MOCK_CONST_METHOD0(GetUUIDs, UUIDList()); | 47 MOCK_CONST_METHOD0(GetUUIDs, UUIDList()); |
47 MOCK_CONST_METHOD0(GetInquiryRSSI, int16()); | 48 MOCK_CONST_METHOD0(GetInquiryRSSI, int16()); |
48 MOCK_CONST_METHOD0(GetInquiryTxPower, int16()); | 49 MOCK_CONST_METHOD0(GetInquiryTxPower, int16()); |
49 MOCK_CONST_METHOD0(ExpectingPinCode, bool()); | 50 MOCK_CONST_METHOD0(ExpectingPinCode, bool()); |
50 MOCK_CONST_METHOD0(ExpectingPasskey, bool()); | 51 MOCK_CONST_METHOD0(ExpectingPasskey, bool()); |
51 MOCK_CONST_METHOD0(ExpectingConfirmation, bool()); | 52 MOCK_CONST_METHOD0(ExpectingConfirmation, bool()); |
52 MOCK_METHOD1(GetConnectionInfo, void(const ConnectionInfoCallback& callback)); | 53 MOCK_METHOD1(GetConnectionInfo, void(const ConnectionInfoCallback& callback)); |
53 MOCK_METHOD3(Connect, | 54 MOCK_METHOD3(Connect, |
(...skipping 21 matching lines...) Expand all Loading... |
75 MOCK_METHOD2(CreateGattConnection, | 76 MOCK_METHOD2(CreateGattConnection, |
76 void(const GattConnectionCallback& callback, | 77 void(const GattConnectionCallback& callback, |
77 const ConnectErrorCallback& error_callback)); | 78 const ConnectErrorCallback& error_callback)); |
78 | 79 |
79 MOCK_METHOD2(StartConnectionMonitor, | 80 MOCK_METHOD2(StartConnectionMonitor, |
80 void(const base::Closure& callback, | 81 void(const base::Closure& callback, |
81 const BluetoothDevice::ErrorCallback& error_callback)); | 82 const BluetoothDevice::ErrorCallback& error_callback)); |
82 | 83 |
83 MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>()); | 84 MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>()); |
84 MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&)); | 85 MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&)); |
| 86 MOCK_METHOD0(CreateGattConnectionImpl, void()); |
| 87 MOCK_METHOD0(DisconnectGatt, void()); |
85 | 88 |
86 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. | 89 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. |
87 // This method takes ownership of the MockBluetoothGATTServices. This is only | 90 // This method takes ownership of the MockBluetoothGATTServices. This is only |
88 // for convenience as far as testing is concerned, and it's possible to write | 91 // for convenience as far as testing is concerned, and it's possible to write |
89 // test cases without using these functions. | 92 // test cases without using these functions. |
90 // Example: | 93 // Example: |
91 // ON_CALL(*mock_device, GetGattServices)) | 94 // ON_CALL(*mock_device, GetGattServices)) |
92 // .WillByDefault(Invoke(*mock_device, | 95 // .WillByDefault(Invoke(*mock_device, |
93 // &MockBluetoothDevice::GetMockServices)); | 96 // &MockBluetoothDevice::GetMockServices)); |
94 void AddMockService(scoped_ptr<MockBluetoothGattService> mock_device); | 97 void AddMockService(scoped_ptr<MockBluetoothGattService> mock_device); |
95 std::vector<BluetoothGattService*> GetMockServices() const; | 98 std::vector<BluetoothGattService*> GetMockServices() const; |
96 BluetoothGattService* GetMockService(const std::string& identifier) const; | 99 BluetoothGattService* GetMockService(const std::string& identifier) const; |
97 | 100 |
98 private: | 101 private: |
99 uint32 bluetooth_class_; | 102 uint32 bluetooth_class_; |
100 std::string name_; | 103 std::string name_; |
101 std::string address_; | 104 std::string address_; |
102 BluetoothDevice::UUIDList uuids_; | 105 BluetoothDevice::UUIDList uuids_; |
103 | 106 |
104 ScopedVector<MockBluetoothGattService> mock_services_; | 107 ScopedVector<MockBluetoothGattService> mock_services_; |
105 }; | 108 }; |
106 | 109 |
107 } // namespace device | 110 } // namespace device |
108 | 111 |
109 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ | 112 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ |
OLD | NEW |