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