| Index: third_party/WebKit/LayoutTests/vibration/vibration.html
|
| diff --git a/third_party/WebKit/LayoutTests/vibration/vibration.html b/third_party/WebKit/LayoutTests/vibration/vibration.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..247790b0142db81373f87cbc51415702c3a1b99b
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/vibration/vibration.html
|
| @@ -0,0 +1,55 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="../resources/mojo-helpers.js"></script>
|
| +<script src="resources/vibration-helpers.js"></script>
|
| +<script>
|
| +
|
| +'use strict';
|
| +
|
| +if (!window.testRunner)
|
| + debug('This test cannot be run without the TestRunner');
|
| +
|
| +vibration_test(vibration => {
|
| + assert_true(vibration instanceof Object);
|
| + assert_true(vibration.mockVibrationManager instanceof Object);
|
| +}, 'VibrationManager Mojo bindings and mock interfaces are available to tests.');
|
| +
|
| +// Cover test case in vibration_browsertest.cc: Vibrate
|
| +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(msgData => {
|
| + assert_equals(msgData, 'Vibrate');
|
| + assert_equals(vibration.mockVibrationManager.getDuration(), 1234);
|
| + assert_false(vibration.mockVibrationManager.isCancelled());
|
| + });
|
| +}, 'navigator.vibrate(1234) can trigger MockVibrationManager vibrate(1234) correctly.');
|
| +
|
| +// Cover test case in vibration_browsertest.cc: Cancel
|
| +vibration_test(vibration => {
|
| + let promise = new Promise(resolve => {
|
| + let listener = msg => {
|
| + window.removeEventListener('message', listener);
|
| + resolve(msg.data);
|
| + };
|
| + window.addEventListener('message', listener);
|
| +
|
| + navigator.vibrate(0);
|
| + });
|
| +
|
| + return promise.then(msgData => {
|
| + assert_equals(msgData, 'Cancel');
|
| + assert_true(vibration.mockVibrationManager.isCancelled());
|
| + });
|
| +}, 'navigator.vibrate(0) can trigger MockVibrationManager cancel() correctly.');
|
| +
|
| +</script>
|
|
|