Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: third_party/WebKit/LayoutTests/vibration/mock-vibration.html

Issue 2731953003: [DeviceService] Replace vibration_browsertest.cc with layout tests. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/testharness-helpers.js"></script>
5 <script src="../resources/mojo-helpers.js"></script>
6 <script src="resources/vibration-helpers.js"></script>
7 <script>
8
9 'use strict';
10
11 vibration_test(vibration => {
12 assert_true(vibration instanceof Object);
13 assert_true(vibration.mockVibrationManager instanceof Object);
14 }, 'VibrationManager Mojo bindings and mock interfaces are available.');
15
16 vibration_test(vibration => {
17 let promise = new Promise(resolve => {
18 let listener = msg => {
19 window.removeEventListener('message', listener);
20 resolve(msg.data);
21 };
22 window.addEventListener('message', listener);
23
24 navigator.vibrate(1234);
25 });
26
27 return promise.then(duration => {
28 assert_equals(duration, 1234);
29 });
30 }, 'navigator.vibrate() can trigger MockVibrationManager vibrate() correctly.');
31
32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698