| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "base/optional.h" |
| 14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 15 #include "device/bluetooth/bluetooth_common.h" | 16 #include "device/bluetooth/bluetooth_common.h" |
| 16 #include "device/bluetooth/bluetooth_device.h" | 17 #include "device/bluetooth/bluetooth_device.h" |
| 17 #include "device/bluetooth/bluetooth_uuid.h" | 18 #include "device/bluetooth/bluetooth_uuid.h" |
| 18 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" | 19 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 20 | 21 |
| 21 namespace device { | 22 namespace device { |
| 22 | 23 |
| 23 class BluetoothRemoteGattService; | 24 class BluetoothRemoteGattService; |
| 24 class MockBluetoothAdapter; | 25 class MockBluetoothAdapter; |
| 25 | 26 |
| 26 class MockBluetoothDevice : public BluetoothDevice { | 27 class MockBluetoothDevice : public BluetoothDevice { |
| 27 public: | 28 public: |
| 28 MockBluetoothDevice(MockBluetoothAdapter* adapter, | 29 MockBluetoothDevice(MockBluetoothAdapter* adapter, |
| 29 uint32_t bluetooth_class, | 30 uint32_t bluetooth_class, |
| 30 const std::string& name, | 31 const char* name, |
| 31 const std::string& address, | 32 const std::string& address, |
| 32 bool paired, | 33 bool paired, |
| 33 bool connected); | 34 bool connected); |
| 34 virtual ~MockBluetoothDevice(); | 35 virtual ~MockBluetoothDevice(); |
| 35 | 36 |
| 36 MOCK_CONST_METHOD0(GetBluetoothClass, uint32_t()); | 37 MOCK_CONST_METHOD0(GetBluetoothClass, uint32_t()); |
| 37 MOCK_CONST_METHOD0(GetType, BluetoothTransport()); | 38 MOCK_CONST_METHOD0(GetType, BluetoothTransport()); |
| 38 MOCK_CONST_METHOD0(GetIdentifier, std::string()); | 39 MOCK_CONST_METHOD0(GetIdentifier, std::string()); |
| 39 MOCK_CONST_METHOD0(GetAddress, std::string()); | 40 MOCK_CONST_METHOD0(GetAddress, std::string()); |
| 40 MOCK_CONST_METHOD0(GetVendorIDSource, BluetoothDevice::VendorIDSource()); | 41 MOCK_CONST_METHOD0(GetVendorIDSource, BluetoothDevice::VendorIDSource()); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // &MockBluetoothDevice::GetMockServices)); | 111 // &MockBluetoothDevice::GetMockServices)); |
| 111 void AddMockService(std::unique_ptr<MockBluetoothGattService> mock_device); | 112 void AddMockService(std::unique_ptr<MockBluetoothGattService> mock_device); |
| 112 std::vector<BluetoothRemoteGattService*> GetMockServices() const; | 113 std::vector<BluetoothRemoteGattService*> GetMockServices() const; |
| 113 BluetoothRemoteGattService* GetMockService( | 114 BluetoothRemoteGattService* GetMockService( |
| 114 const std::string& identifier) const; | 115 const std::string& identifier) const; |
| 115 | 116 |
| 116 void SetConnected(bool connected) { connected_ = connected; } | 117 void SetConnected(bool connected) { connected_ = connected; } |
| 117 | 118 |
| 118 private: | 119 private: |
| 119 uint32_t bluetooth_class_; | 120 uint32_t bluetooth_class_; |
| 120 std::string name_; | 121 base::Optional<std::string> name_; |
| 121 std::string address_; | 122 std::string address_; |
| 122 BluetoothDevice::UUIDList uuids_; | 123 BluetoothDevice::UUIDList uuids_; |
| 123 bool connected_; | 124 bool connected_; |
| 124 | 125 |
| 125 ScopedVector<MockBluetoothGattService> mock_services_; | 126 ScopedVector<MockBluetoothGattService> mock_services_; |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace device | 129 } // namespace device |
| 129 | 130 |
| 130 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ | 131 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |