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/utf_string_conversions.h" | 7 #include "base/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 const std::string& name, | 14 const std::string& name, |
14 const std::string& address, | 15 const std::string& address, |
15 bool paired, | 16 bool paired, |
16 bool bonded, | |
17 bool connected) | 17 bool connected) |
18 : name_(UTF8ToUTF16(name)), | 18 : bluetooth_class_(bluetooth_class), |
| 19 name_(name), |
19 address_(address) { | 20 address_(address) { |
20 ON_CALL(*this, GetName()) | 21 ON_CALL(*this, GetBluetoothClass()) |
| 22 .WillByDefault(testing::Return(bluetooth_class_)); |
| 23 ON_CALL(*this, GetDeviceName()) |
21 .WillByDefault(testing::Return(name_)); | 24 .WillByDefault(testing::Return(name_)); |
22 ON_CALL(*this, address()) | 25 ON_CALL(*this, GetAddress()) |
23 .WillByDefault(testing::ReturnRef(address_)); | 26 .WillByDefault(testing::Return(address_)); |
24 ON_CALL(*this, IsPaired()) | 27 ON_CALL(*this, IsPaired()) |
25 .WillByDefault(testing::Return(paired)); | 28 .WillByDefault(testing::Return(paired)); |
26 ON_CALL(*this, IsBonded()) | |
27 .WillByDefault(testing::Return(bonded)); | |
28 ON_CALL(*this, IsConnected()) | 29 ON_CALL(*this, IsConnected()) |
29 .WillByDefault(testing::Return(connected)); | 30 .WillByDefault(testing::Return(connected)); |
| 31 ON_CALL(*this, IsConnectable()) |
| 32 .WillByDefault(testing::Return(false)); |
| 33 ON_CALL(*this, IsConnecting()) |
| 34 .WillByDefault(testing::Return(false)); |
| 35 ON_CALL(*this, GetName()) |
| 36 .WillByDefault(testing::Return(UTF8ToUTF16(name_))); |
30 ON_CALL(*this, ExpectingPinCode()) | 37 ON_CALL(*this, ExpectingPinCode()) |
31 .WillByDefault(testing::Return(false)); | 38 .WillByDefault(testing::Return(false)); |
32 ON_CALL(*this, ExpectingPasskey()) | 39 ON_CALL(*this, ExpectingPasskey()) |
33 .WillByDefault(testing::Return(false)); | 40 .WillByDefault(testing::Return(false)); |
34 ON_CALL(*this, ExpectingConfirmation()) | 41 ON_CALL(*this, ExpectingConfirmation()) |
35 .WillByDefault(testing::Return(false)); | 42 .WillByDefault(testing::Return(false)); |
36 ON_CALL(*this, GetServices()) | 43 ON_CALL(*this, GetServices()) |
37 .WillByDefault(testing::ReturnRef(service_list_)); | 44 .WillByDefault(testing::Return(service_list_)); |
38 } | 45 } |
39 | 46 |
40 MockBluetoothDevice::~MockBluetoothDevice() {} | 47 MockBluetoothDevice::~MockBluetoothDevice() {} |
41 | 48 |
42 } // namespace device | 49 } // namespace device |
OLD | NEW |