15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "device/bluetooth/test/mock_bluetooth_device.h" 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/utf_string_conversions.h" 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "device/bluetooth/test/mock_bluetooth_adapter.h" 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace device { 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, 13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) uint32 bluetooth_class, 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const std::string& name, 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const std::string& address, 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool paired, 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool connected) 18c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) : bluetooth_class_(bluetooth_class), 19c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) name_(name), 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) address_(address) { 21c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) ON_CALL(*this, GetBluetoothClass()) 22c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) .WillByDefault(testing::Return(bluetooth_class_)); 23c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) ON_CALL(*this, GetDeviceName()) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) .WillByDefault(testing::Return(name_)); 25c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) ON_CALL(*this, GetAddress()) 26c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) .WillByDefault(testing::Return(address_)); 27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ON_CALL(*this, GetDeviceType()) 28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .WillByDefault(testing::Return(DEVICE_UNKNOWN)); 295c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu ON_CALL(*this, GetRSSI()) 305c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu .WillByDefault(testing::Return(kUnknownPower)); 315c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu ON_CALL(*this, GetCurrentHostTransmitPower()) 325c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu .WillByDefault(testing::Return(kUnknownPower)); 335c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu ON_CALL(*this, GetMaximumHostTransmitPower()) 345c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu .WillByDefault(testing::Return(kUnknownPower)); 35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ON_CALL(*this, GetVendorIDSource()) 36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .WillByDefault(testing::Return(VENDOR_ID_UNKNOWN)); 37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ON_CALL(*this, GetVendorID()) 38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .WillByDefault(testing::Return(0)); 39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ON_CALL(*this, GetProductID()) 40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .WillByDefault(testing::Return(0)); 41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ON_CALL(*this, GetDeviceID()) 42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) .WillByDefault(testing::Return(0)); 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ON_CALL(*this, IsPaired()) 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) .WillByDefault(testing::Return(paired)); 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ON_CALL(*this, IsConnected()) 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) .WillByDefault(testing::Return(connected)); 47c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) ON_CALL(*this, IsConnectable()) 48c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) .WillByDefault(testing::Return(false)); 49c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) ON_CALL(*this, IsConnecting()) 50c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) .WillByDefault(testing::Return(false)); 51c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) ON_CALL(*this, GetName()) 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) .WillByDefault(testing::Return(base::UTF8ToUTF16(name_))); 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ON_CALL(*this, ExpectingPinCode()) 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) .WillByDefault(testing::Return(false)); 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ON_CALL(*this, ExpectingPasskey()) 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) .WillByDefault(testing::Return(false)); 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ON_CALL(*this, ExpectingConfirmation()) 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) .WillByDefault(testing::Return(false)); 5923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) ON_CALL(*this, GetUUIDs()) 6023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) .WillByDefault(testing::Return(uuids_)); 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)MockBluetoothDevice::~MockBluetoothDevice() {} 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace device 66