| Index: Source/modules/bluetooth/testing/BluetoothMock.cpp
|
| diff --git a/Source/modules/bluetooth/testing/BluetoothMock.cpp b/Source/modules/bluetooth/testing/BluetoothMock.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c61d3f6c5eae79379bba6d87dd1e3c43d47f6169
|
| --- /dev/null
|
| +++ b/Source/modules/bluetooth/testing/BluetoothMock.cpp
|
| @@ -0,0 +1,34 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "modules/bluetooth/testing/BluetoothMock.h"
|
| +
|
| +namespace blink {
|
| +
|
| +BluetoothMock::BluetoothMock()
|
| + : m_bluetoothRequestDeviceWillReject(false)
|
| + , m_bluetoothRequestDeviceRejectType(WebBluetoothError::NotFoundError)
|
| +{
|
| +}
|
| +
|
| +void BluetoothMock::bluetoothRequestDeviceWillReject(WebBluetoothError::ErrorType e)
|
| +{
|
| + m_bluetoothRequestDeviceWillReject = true;
|
| + m_bluetoothRequestDeviceRejectType = e;
|
| +}
|
| +
|
| +void BluetoothMock::requestDevice(WebBluetoothRequestDeviceCallbacks* callbacks)
|
| +{
|
| + if (m_bluetoothRequestDeviceWillReject) {
|
| + WebBluetoothError* error = new WebBluetoothError(
|
| + m_bluetoothRequestDeviceRejectType, "");
|
| + callbacks->onError(error);
|
| + } else {
|
| + callbacks->onSuccess();
|
| + }
|
| +}
|
| +
|
| +} // namespace blink
|
| +
|
|
|