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 3 // found in the LICENSE file. 4 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ 7 8 #include <string> 9 10 #include "base/strings/string16.h" 11 #include "device/bluetooth/bluetooth_device.h" 12 #include "device/bluetooth/bluetooth_out_of_band_pairing_data.h" 13 #include "testing/gmock/include/gmock/gmock.h" 14 15 namespace device { 16 17 class MockBluetoothAdapter; 18 19 class MockBluetoothDevice : public BluetoothDevice { 20 public: 21 MockBluetoothDevice(MockBluetoothAdapter* adapter, 22 uint32 bluetooth_class, 23 const std::string& name, 24 const std::string& address, 25 bool paired, 26 bool connected); 27 virtual ~MockBluetoothDevice(); 28 29 MOCK_CONST_METHOD0(GetBluetoothClass, uint32()); 30 MOCK_CONST_METHOD0(GetDeviceName, std::string()); 31 MOCK_CONST_METHOD0(GetAddress, std::string()); 32 MOCK_CONST_METHOD0(GetVendorID, uint16()); 33 MOCK_CONST_METHOD0(GetProductID, uint16()); 34 MOCK_CONST_METHOD0(GetDeviceID, uint16()); 35 MOCK_CONST_METHOD0(GetName, string16()); 36 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType()); 37 MOCK_CONST_METHOD0(IsPaired, bool()); 38 MOCK_CONST_METHOD0(IsConnected, bool()); 39 MOCK_CONST_METHOD0(IsConnectable, bool()); 40 MOCK_CONST_METHOD0(IsConnecting, bool()); 41 MOCK_CONST_METHOD0(GetServices, ServiceList()); 42 MOCK_METHOD2(GetServiceRecords, 43 void(const BluetoothDevice::ServiceRecordsCallback&, 44 const BluetoothDevice::ErrorCallback&)); 45 MOCK_CONST_METHOD1(ProvidesServiceWithUUID, bool(const std::string&)); 46 MOCK_METHOD2(ProvidesServiceWithName, 47 void(const std::string&, 48 const BluetoothDevice::ProvidesServiceCallback&)); 49 MOCK_CONST_METHOD0(ExpectingPinCode, bool()); 50 MOCK_CONST_METHOD0(ExpectingPasskey, bool()); 51 MOCK_CONST_METHOD0(ExpectingConfirmation, bool()); 52 MOCK_METHOD3(Connect, 53 void(BluetoothDevice::PairingDelegate* pairing_delegate, 54 const base::Closure& callback, 55 const BluetoothDevice::ConnectErrorCallback& 56 error_callback)); 57 MOCK_METHOD1(SetPinCode, void(const std::string&)); 58 MOCK_METHOD1(SetPasskey, void(uint32)); 59 MOCK_METHOD0(ConfirmPairing, void()); 60 MOCK_METHOD0(RejectPairing, void()); 61 MOCK_METHOD0(CancelPairing, void()); 62 MOCK_METHOD2(Disconnect, 63 void(const base::Closure& callback, 64 const BluetoothDevice::ErrorCallback& error_callback)); 65 MOCK_METHOD1(Forget, void(const BluetoothDevice::ErrorCallback&)); 66 MOCK_METHOD2(ConnectToService, 67 void(const std::string&, 68 const BluetoothDevice::SocketCallback&)); 69 MOCK_METHOD3(ConnectToProfile, 70 void(BluetoothProfile*, 71 const base::Closure&, 72 const BluetoothDevice::ErrorCallback&)); 73 74 MOCK_METHOD3(SetOutOfBandPairingData, 75 void(const BluetoothOutOfBandPairingData& data, 76 const base::Closure& callback, 77 const BluetoothDevice::ErrorCallback& error_callback)); 78 MOCK_METHOD2(ClearOutOfBandPairingData, 79 void(const base::Closure& callback, 80 const BluetoothDevice::ErrorCallback& error_callback)); 81 82 private: 83 uint32 bluetooth_class_; 84 std::string name_; 85 std::string address_; 86 BluetoothDevice::ServiceList service_list_; 87 }; 88 89 } // namespace device 90 91 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ 92