| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 const ConnectToServiceCallback& callback, | 81 const ConnectToServiceCallback& callback, |
| 82 const ConnectToServiceErrorCallback& error_callback)); | 82 const ConnectToServiceErrorCallback& error_callback)); |
| 83 MOCK_METHOD3(ConnectToServiceInsecurely, | 83 MOCK_METHOD3(ConnectToServiceInsecurely, |
| 84 void(const BluetoothUUID& uuid, | 84 void(const BluetoothUUID& uuid, |
| 85 const ConnectToServiceCallback& callback, | 85 const ConnectToServiceCallback& callback, |
| 86 const ConnectToServiceErrorCallback& error_callback)); | 86 const ConnectToServiceErrorCallback& error_callback)); |
| 87 MOCK_METHOD2(CreateGattConnection, | 87 MOCK_METHOD2(CreateGattConnection, |
| 88 void(const GattConnectionCallback& callback, | 88 void(const GattConnectionCallback& callback, |
| 89 const ConnectErrorCallback& error_callback)); | 89 const ConnectErrorCallback& error_callback)); |
| 90 | 90 |
| 91 MOCK_METHOD1(SetGattServicesDiscoveryComplete, void(bool)); |
| 92 MOCK_CONST_METHOD0(IsGattServicesDiscoveryComplete, bool()); |
| 93 |
| 91 MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>()); | 94 MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>()); |
| 92 MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&)); | 95 MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&)); |
| 93 MOCK_METHOD0(CreateGattConnectionImpl, void()); | 96 MOCK_METHOD0(CreateGattConnectionImpl, void()); |
| 94 MOCK_METHOD0(DisconnectGatt, void()); | 97 MOCK_METHOD0(DisconnectGatt, void()); |
| 95 | 98 |
| 96 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. | 99 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. |
| 97 // This method takes ownership of the MockBluetoothGATTServices. This is only | 100 // This method takes ownership of the MockBluetoothGATTServices. This is only |
| 98 // for convenience as far as testing is concerned, and it's possible to write | 101 // for convenience as far as testing is concerned, and it's possible to write |
| 99 // test cases without using these functions. | 102 // test cases without using these functions. |
| 100 // Example: | 103 // Example: |
| 101 // ON_CALL(*mock_device, GetGattServices)) | 104 // ON_CALL(*mock_device, GetGattServices)) |
| 102 // .WillByDefault(Invoke(*mock_device, | 105 // .WillByDefault(Invoke(*mock_device, |
| 103 // &MockBluetoothDevice::GetMockServices)); | 106 // &MockBluetoothDevice::GetMockServices)); |
| 104 void AddMockService(std::unique_ptr<MockBluetoothGattService> mock_device); | 107 void AddMockService(std::unique_ptr<MockBluetoothGattService> mock_device); |
| 105 std::vector<BluetoothGattService*> GetMockServices() const; | 108 std::vector<BluetoothGattService*> GetMockServices() const; |
| 106 BluetoothGattService* GetMockService(const std::string& identifier) const; | 109 BluetoothGattService* GetMockService(const std::string& identifier) const; |
| 107 | 110 |
| 108 private: | 111 private: |
| 109 uint32_t bluetooth_class_; | 112 uint32_t bluetooth_class_; |
| 110 std::string name_; | 113 std::string name_; |
| 111 std::string address_; | 114 std::string address_; |
| 112 BluetoothDevice::UUIDList uuids_; | 115 BluetoothDevice::UUIDList uuids_; |
| 113 | 116 |
| 114 ScopedVector<MockBluetoothGattService> mock_services_; | 117 ScopedVector<MockBluetoothGattService> mock_services_; |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 } // namespace device | 120 } // namespace device |
| 118 | 121 |
| 119 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ | 122 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |