Chromium Code Reviews| 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 #include "device/bluetooth/test/mock_bluetooth_device.h" | 5 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 8 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 9 | 9 |
| 10 namespace device { | 10 namespace device { |
| 11 | 11 |
| 12 MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, | 12 MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, |
| 13 uint32 bluetooth_class, | 13 uint32 bluetooth_class, |
| 14 const std::string& name, | 14 const std::string& name, |
| 15 const std::string& address, | 15 const std::string& address, |
| 16 bool paired, | 16 bool paired, |
| 17 bool connected) | 17 bool connected) |
| 18 : bluetooth_class_(bluetooth_class), | 18 : bluetooth_class_(bluetooth_class), |
| 19 name_(name), | 19 name_(name), |
| 20 address_(address) { | 20 address_(address) { |
| 21 ON_CALL(*this, GetBluetoothClass()) | 21 ON_CALL(*this, GetBluetoothClass()) |
| 22 .WillByDefault(testing::Return(bluetooth_class_)); | 22 .WillByDefault(testing::Return(bluetooth_class_)); |
| 23 ON_CALL(*this, GetDeviceName()) | 23 ON_CALL(*this, GetDeviceName()) |
| 24 .WillByDefault(testing::Return(name_)); | 24 .WillByDefault(testing::Return(name_)); |
| 25 ON_CALL(*this, GetAddress()) | 25 ON_CALL(*this, GetAddress()) |
| 26 .WillByDefault(testing::Return(address_)); | 26 .WillByDefault(testing::Return(address_)); |
| 27 ON_CALL(*this, GetDeviceType()) | 27 ON_CALL(*this, GetDeviceType()) |
| 28 .WillByDefault(testing::Return(DEVICE_UNKNOWN)); | 28 .WillByDefault(testing::Return(DEVICE_UNKNOWN)); |
| 29 ON_CALL(*this, GetRSSI()) | |
| 30 .WillByDefault(testing::Return(kUnknownPower)); | |
| 31 ON_CALL(*this, GetCurrentHostTransmitPower()) | |
| 32 .WillByDefault(testing::Return(kUnknownPower)); | |
| 33 ON_CALL(*this, GetMaximumHostTransmitPower()) | |
| 34 .WillByDefault(testing::Return(kUnknownPower)); | |
|
Ilya Sherman
2014/11/19 22:18:07
Do you not need a default value to return for call
Tim Song
2014/12/06 00:51:38
GetConnectionInfo is an async method, so adding a
| |
| 35 ON_CALL(*this, GetVendorIDSource()) | 29 ON_CALL(*this, GetVendorIDSource()) |
| 36 .WillByDefault(testing::Return(VENDOR_ID_UNKNOWN)); | 30 .WillByDefault(testing::Return(VENDOR_ID_UNKNOWN)); |
| 37 ON_CALL(*this, GetVendorID()) | 31 ON_CALL(*this, GetVendorID()) |
| 38 .WillByDefault(testing::Return(0)); | 32 .WillByDefault(testing::Return(0)); |
| 39 ON_CALL(*this, GetProductID()) | 33 ON_CALL(*this, GetProductID()) |
| 40 .WillByDefault(testing::Return(0)); | 34 .WillByDefault(testing::Return(0)); |
| 41 ON_CALL(*this, GetDeviceID()) | 35 ON_CALL(*this, GetDeviceID()) |
| 42 .WillByDefault(testing::Return(0)); | 36 .WillByDefault(testing::Return(0)); |
| 43 ON_CALL(*this, IsPaired()) | 37 ON_CALL(*this, IsPaired()) |
| 44 .WillByDefault(testing::Return(paired)); | 38 .WillByDefault(testing::Return(paired)); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 56 .WillByDefault(testing::Return(false)); | 50 .WillByDefault(testing::Return(false)); |
| 57 ON_CALL(*this, ExpectingConfirmation()) | 51 ON_CALL(*this, ExpectingConfirmation()) |
| 58 .WillByDefault(testing::Return(false)); | 52 .WillByDefault(testing::Return(false)); |
| 59 ON_CALL(*this, GetUUIDs()) | 53 ON_CALL(*this, GetUUIDs()) |
| 60 .WillByDefault(testing::Return(uuids_)); | 54 .WillByDefault(testing::Return(uuids_)); |
| 61 } | 55 } |
| 62 | 56 |
| 63 MockBluetoothDevice::~MockBluetoothDevice() {} | 57 MockBluetoothDevice::~MockBluetoothDevice() {} |
| 64 | 58 |
| 65 } // namespace device | 59 } // namespace device |
| OLD | NEW |