Index: third_party/WebKit/LayoutTests/vibration/mock-vibration.html |
diff --git a/third_party/WebKit/LayoutTests/vibration/mock-vibration.html b/third_party/WebKit/LayoutTests/vibration/mock-vibration.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cb2662737e607cef187410e1662b7e7788de82e6 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/vibration/mock-vibration.html |
@@ -0,0 +1,32 @@ |
+<!DOCTYPE html> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="../resources/testharness-helpers.js"></script> |
+<script src="../resources/mojo-helpers.js"></script> |
+<script src="resources/vibration-helpers.js"></script> |
+<script> |
+ |
+'use strict'; |
+ |
+vibration_test(vibration => { |
+ assert_true(vibration instanceof Object); |
+ assert_true(vibration.mockVibrationManager instanceof Object); |
+}, 'VibrationManager Mojo bindings and mock interfaces are available.'); |
+ |
+vibration_test(vibration => { |
+ let promise = new Promise(resolve => { |
+ let listener = msg => { |
+ window.removeEventListener('message', listener); |
+ resolve(msg.data); |
+ }; |
+ window.addEventListener('message', listener); |
+ |
+ navigator.vibrate(1234); |
+ }); |
+ |
+ return promise.then(duration => { |
+ assert_equals(duration, 1234); |
+ }); |
+}, 'navigator.vibrate() can trigger MockVibrationManager vibrate() correctly.'); |
+ |
+</script> |