OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 #include "config.h" |
| 6 #include "modules/bluetooth/testing/BluetoothMock.h" |
| 7 |
| 8 namespace blink { |
| 9 |
| 10 BluetoothMock::BluetoothMock() |
| 11 : m_bluetoothRequestDeviceWillReject(false) |
| 12 , m_bluetoothRequestDeviceRejectType(WebBluetoothError::NotFoundError) |
| 13 { |
| 14 } |
| 15 |
| 16 void BluetoothMock::bluetoothRequestDeviceWillReject(WebBluetoothError::ErrorTyp
e e) |
| 17 { |
| 18 m_bluetoothRequestDeviceWillReject = true; |
| 19 m_bluetoothRequestDeviceRejectType = e; |
| 20 } |
| 21 |
| 22 void BluetoothMock::requestDevice(WebBluetoothRequestDeviceCallbacks* callbacks) |
| 23 { |
| 24 if (m_bluetoothRequestDeviceWillReject) { |
| 25 WebBluetoothError* error = new WebBluetoothError( |
| 26 m_bluetoothRequestDeviceRejectType, ""); |
| 27 callbacks->onError(error); |
| 28 } else { |
| 29 callbacks->onSuccess(); |
| 30 } |
| 31 } |
| 32 |
| 33 } // namespace blink |
| 34 |
OLD | NEW |