Index: third_party/WebKit/Source/modules/bluetooth/BluetoothFakeBluetooth.cpp |
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothFakeBluetooth.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothFakeBluetooth.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d0c50e42020ed8207507d493c0383483af383ae0 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothFakeBluetooth.cpp |
@@ -0,0 +1,46 @@ |
+// Copyright 2017 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 "modules/bluetooth/BluetoothFakeBluetooth.h" |
+ |
+#include "modules/bluetooth/Bluetooth.h" |
+#include "modules/bluetooth/FakeBluetooth.h" |
+ |
+namespace blink { |
+ |
+BluetoothFakeBluetooth& BluetoothFakeBluetooth::from(Bluetooth& bluetooth) { |
+ BluetoothFakeBluetooth* supplement = static_cast<BluetoothFakeBluetooth*>( |
+ Supplement<Bluetooth>::from(bluetooth, supplementName())); |
+ |
+ if (!supplement) { |
+ supplement = new BluetoothFakeBluetooth(bluetooth); |
+ provideTo(bluetooth, supplementName(), supplement); |
+ } |
+ return *supplement; |
+} |
+ |
+FakeBluetooth* BluetoothFakeBluetooth::test(Bluetooth& bluetooth) { |
+ return BluetoothFakeBluetooth::from(bluetooth).test(); |
+} |
+ |
+FakeBluetooth* BluetoothFakeBluetooth::test() { |
+ if (!m_test) |
+ m_test = FakeBluetooth::create(); |
+ return m_test.get(); |
+} |
+ |
+DEFINE_TRACE(BluetoothFakeBluetooth) { |
+ visitor->trace(m_test); |
+ Supplement<Bluetooth>::trace(visitor); |
+} |
+ |
+BluetoothFakeBluetooth::BluetoothFakeBluetooth(Bluetooth& bluetooth) |
+ : Supplement<Bluetooth>(bluetooth) { |
+} |
+ |
+const char* BluetoothFakeBluetooth::supplementName() { |
+ return "BluetoothFakeBluetooth"; |
+} |
+ |
+} // namespace blink |