Index: Source/modules/bluetooth/testing/InternalsBluetooth.cpp |
diff --git a/Source/modules/bluetooth/testing/InternalsBluetooth.cpp b/Source/modules/bluetooth/testing/InternalsBluetooth.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..413838e7f8efebb3f4437c12d48dd7f29c838a57 |
--- /dev/null |
+++ b/Source/modules/bluetooth/testing/InternalsBluetooth.cpp |
@@ -0,0 +1,33 @@ |
+// 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 "InternalsBluetooth.h" |
+ |
+#include "core/frame/Navigator.h" |
+#include "core/testing/Internals.h" |
+#include "modules/bluetooth/Bluetooth.h" |
+#include "modules/bluetooth/NavigatorBluetooth.h" |
+#include "modules/bluetooth/testing/BluetoothMock.h" |
+ |
+namespace blink { |
+ |
+void InternalsBluetooth::resetBluetoothMock(Internals&, Navigator* navigator) |
+{ |
+ NavigatorBluetooth::bluetooth(*navigator)->resetBluetoothMockForTesting(); |
+} |
+ |
+void InternalsBluetooth::bluetoothRequestDeviceWillReject(Internals&, Navigator* navigator, const String& error) |
+{ |
+ BluetoothMock* mock = NavigatorBluetooth::bluetooth(*navigator)->getBluetoothMockForTesting(); |
+ if (error == "NotFoundError") |
+ mock->bluetoothRequestDeviceWillReject(WebBluetoothError::NotFoundError); |
+ else if (error == "SecurityError") |
+ mock->bluetoothRequestDeviceWillReject(WebBluetoothError::SecurityError); |
+ else |
+ ASSERT_NOT_REACHED(); |
+} |
+ |
+} // namespace blink |
+ |