| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 const ConnectErrorCallback& error_callback)); | 76 const ConnectErrorCallback& error_callback)); |
| 77 | 77 |
| 78 MOCK_METHOD2(StartConnectionMonitor, | 78 MOCK_METHOD2(StartConnectionMonitor, |
| 79 void(const base::Closure& callback, | 79 void(const base::Closure& callback, |
| 80 const BluetoothDevice::ErrorCallback& error_callback)); | 80 const BluetoothDevice::ErrorCallback& error_callback)); |
| 81 | 81 |
| 82 MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>()); | 82 MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>()); |
| 83 MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&)); | 83 MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&)); |
| 84 | 84 |
| 85 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. | 85 // BluetoothDevice manages the lifetime of its BluetoothGATTServices. |
| 86 // This methods takes ownership of the BluetoothGATTServices. This is only for | 86 // This methods takes ownership of the MockBluetoothGATTServices. This is only |
| 87 // convenience as far as testing is concerned, and it's possible to write test | 87 // for convenience as far as testing is concerned, and it's possible to write |
| 88 // cases without using these functions. | 88 // test cases without using these functions. |
| 89 // Example: | 89 // Example: |
| 90 // ON_CALL(*mock_device, GetGattServices)) | 90 // ON_CALL(*mock_device, GetGattServices)) |
| 91 // .WillByDefault(Invoke(*mock_device, | 91 // .WillByDefault(Invoke(*mock_device, |
| 92 // &MockBluetoothDevice::GetMockServices)); | 92 // &MockBluetoothDevice::GetMockServices)); |
| 93 void AddMockService(scoped_ptr<MockBluetoothGattService> mock_device); | 93 void AddMockService(scoped_ptr<MockBluetoothGattService> mock_device); |
| 94 std::vector<BluetoothGattService*> GetMockServices() const; | 94 std::vector<BluetoothGattService*> GetMockServices() const; |
| 95 BluetoothGattService* GetMockService(const std::string& identifier) const; |
| 95 | 96 |
| 96 private: | 97 private: |
| 97 uint32 bluetooth_class_; | 98 uint32 bluetooth_class_; |
| 98 std::string name_; | 99 std::string name_; |
| 99 std::string address_; | 100 std::string address_; |
| 100 BluetoothDevice::UUIDList uuids_; | 101 BluetoothDevice::UUIDList uuids_; |
| 101 | 102 |
| 102 ScopedVector<MockBluetoothGattService> mock_services_; | 103 ScopedVector<MockBluetoothGattService> mock_services_; |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 } // namespace device | 106 } // namespace device |
| 106 | 107 |
| 107 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ | 108 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |