Home | History | Annotate | Download | only in test
      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_ADAPTER_H_
      6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_
      7 
      8 #include <string>
      9 
     10 #include "base/callback.h"
     11 #include "device/bluetooth/bluetooth_adapter.h"
     12 #include "device/bluetooth/bluetooth_device.h"
     13 #include "testing/gmock/include/gmock/gmock.h"
     14 
     15 namespace device {
     16 
     17 class MockBluetoothAdapter : public BluetoothAdapter {
     18  public:
     19   class Observer : public BluetoothAdapter::Observer {
     20    public:
     21     Observer();
     22     virtual ~Observer();
     23 
     24     MOCK_METHOD2(AdapterPresentChanged, void(BluetoothAdapter*, bool));
     25     MOCK_METHOD2(AdapterPoweredChanged, void(BluetoothAdapter*, bool));
     26     MOCK_METHOD2(AdapterDiscoveringChanged, void(BluetoothAdapter*, bool));
     27     MOCK_METHOD2(DeviceAdded, void(BluetoothAdapter*, BluetoothDevice*));
     28     MOCK_METHOD2(DeviceChanged, void(BluetoothAdapter*, BluetoothDevice*));
     29     MOCK_METHOD2(DeviceRemoved, void(BluetoothAdapter*, BluetoothDevice*));
     30   };
     31 
     32   MockBluetoothAdapter();
     33 
     34   MOCK_METHOD1(AddObserver, void(BluetoothAdapter::Observer*));
     35   MOCK_METHOD1(RemoveObserver, void(BluetoothAdapter::Observer*));
     36   MOCK_CONST_METHOD0(GetAddress, std::string());
     37   MOCK_CONST_METHOD0(GetName, std::string());
     38   MOCK_CONST_METHOD0(IsInitialized, bool());
     39   MOCK_CONST_METHOD0(IsPresent, bool());
     40   MOCK_CONST_METHOD0(IsPowered, bool());
     41   MOCK_METHOD3(SetPowered,
     42                void(bool discovering,
     43                     const base::Closure& callback,
     44                     const ErrorCallback& error_callback));
     45   MOCK_CONST_METHOD0(IsDiscovering, bool());
     46   MOCK_METHOD2(StartDiscovering,
     47                void(const base::Closure& callback,
     48                     const ErrorCallback& error_callback));
     49   MOCK_METHOD2(StopDiscovering,
     50                void(const base::Closure& callback,
     51                     const ErrorCallback& error_callback));
     52   MOCK_CONST_METHOD0(GetDevices, BluetoothAdapter::ConstDeviceList());
     53   MOCK_METHOD1(GetDevice, BluetoothDevice*(const std::string& address));
     54   MOCK_CONST_METHOD1(GetDevice,
     55                      const BluetoothDevice*(const std::string& address));
     56   MOCK_METHOD2(
     57       ReadLocalOutOfBandPairingData,
     58       void(const BluetoothOutOfBandPairingDataCallback& callback,
     59            const ErrorCallback& error_callback));
     60  protected:
     61   virtual ~MockBluetoothAdapter();
     62 };
     63 
     64 }  // namespace device
     65 
     66 #endif  // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_
     67