Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / device / bluetooth / test / mock_bluetooth_device.h
blobd2318e776fe797f1cb0b9cea9042aa886d2c25bf
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.
5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_
6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_
8 #include <string>
10 #include "base/memory/scoped_vector.h"
11 #include "base/strings/string16.h"
12 #include "device/bluetooth/bluetooth_device.h"
13 #include "device/bluetooth/bluetooth_uuid.h"
14 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h"
15 #include "testing/gmock/include/gmock/gmock.h"
17 namespace device {
19 class BluetoothGattService;
20 class MockBluetoothAdapter;
22 class MockBluetoothDevice : public BluetoothDevice {
23 public:
24 MockBluetoothDevice(MockBluetoothAdapter* adapter,
25 uint32 bluetooth_class,
26 const std::string& name,
27 const std::string& address,
28 bool paired,
29 bool connected);
30 virtual ~MockBluetoothDevice();
32 MOCK_CONST_METHOD0(GetBluetoothClass, uint32());
33 MOCK_CONST_METHOD0(GetDeviceName, std::string());
34 MOCK_CONST_METHOD0(GetIdentifier, std::string());
35 MOCK_CONST_METHOD0(GetAddress, std::string());
36 MOCK_CONST_METHOD0(GetVendorIDSource, BluetoothDevice::VendorIDSource());
37 MOCK_CONST_METHOD0(GetVendorID, uint16());
38 MOCK_CONST_METHOD0(GetProductID, uint16());
39 MOCK_CONST_METHOD0(GetDeviceID, uint16());
40 MOCK_CONST_METHOD0(GetName, base::string16());
41 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType());
42 MOCK_CONST_METHOD0(IsPaired, bool());
43 MOCK_CONST_METHOD0(IsConnected, bool());
44 MOCK_CONST_METHOD0(IsGattConnected, bool());
45 MOCK_CONST_METHOD0(IsConnectable, bool());
46 MOCK_CONST_METHOD0(IsConnecting, bool());
47 MOCK_CONST_METHOD0(GetUUIDs, UUIDList());
48 MOCK_CONST_METHOD0(GetInquiryRSSI, int16());
49 MOCK_CONST_METHOD0(GetInquiryTxPower, int16());
50 MOCK_CONST_METHOD0(ExpectingPinCode, bool());
51 MOCK_CONST_METHOD0(ExpectingPasskey, bool());
52 MOCK_CONST_METHOD0(ExpectingConfirmation, bool());
53 MOCK_METHOD1(GetConnectionInfo, void(const ConnectionInfoCallback& callback));
54 MOCK_METHOD3(Connect,
55 void(BluetoothDevice::PairingDelegate* pairing_delegate,
56 const base::Closure& callback,
57 const BluetoothDevice::ConnectErrorCallback&
58 error_callback));
59 MOCK_METHOD1(SetPinCode, void(const std::string&));
60 MOCK_METHOD1(SetPasskey, void(uint32));
61 MOCK_METHOD0(ConfirmPairing, void());
62 MOCK_METHOD0(RejectPairing, void());
63 MOCK_METHOD0(CancelPairing, void());
64 MOCK_METHOD2(Disconnect,
65 void(const base::Closure& callback,
66 const BluetoothDevice::ErrorCallback& error_callback));
67 MOCK_METHOD1(Forget, void(const BluetoothDevice::ErrorCallback&));
68 MOCK_METHOD3(ConnectToService,
69 void(const BluetoothUUID& uuid,
70 const ConnectToServiceCallback& callback,
71 const ConnectToServiceErrorCallback& error_callback));
72 MOCK_METHOD3(ConnectToServiceInsecurely,
73 void(const BluetoothUUID& uuid,
74 const ConnectToServiceCallback& callback,
75 const ConnectToServiceErrorCallback& error_callback));
76 MOCK_METHOD2(CreateGattConnection,
77 void(const GattConnectionCallback& callback,
78 const ConnectErrorCallback& error_callback));
80 MOCK_CONST_METHOD0(GetGattServices, std::vector<BluetoothGattService*>());
81 MOCK_CONST_METHOD1(GetGattService, BluetoothGattService*(const std::string&));
82 MOCK_METHOD0(CreateGattConnectionImpl, void());
83 MOCK_METHOD0(DisconnectGatt, void());
85 // BluetoothDevice manages the lifetime of its BluetoothGATTServices.
86 // This method takes ownership of the MockBluetoothGATTServices. This is only
87 // for convenience as far as testing is concerned, and it's possible to write
88 // test cases without using these functions.
89 // Example:
90 // ON_CALL(*mock_device, GetGattServices))
91 // .WillByDefault(Invoke(*mock_device,
92 // &MockBluetoothDevice::GetMockServices));
93 void AddMockService(scoped_ptr<MockBluetoothGattService> mock_device);
94 std::vector<BluetoothGattService*> GetMockServices() const;
95 BluetoothGattService* GetMockService(const std::string& identifier) const;
97 private:
98 uint32 bluetooth_class_;
99 std::string name_;
100 std::string address_;
101 BluetoothDevice::UUIDList uuids_;
103 ScopedVector<MockBluetoothGattService> mock_services_;
106 } // namespace device
108 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_