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

Side by Side Diff: content/test/data/device_sensors/device_motion_test.html

Issue 2948253002: Revert of Refactor DeviceMotionEventPump to use //device/generic_sensor instead of //device/sensors (Closed)
Patch Set: Created 3 years, 5 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
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>DeviceMotion test</title> 3 <title>DeviceMotion test</title>
4 <script type="text/javascript"> 4 <script type="text/javascript">
5 let expectedInterval = Math.floor(1000 / 60);
6 function checkMotionEvent(event) { 5 function checkMotionEvent(event) {
7 return event.acceleration.x == 1 && 6 return event.acceleration.x == 1 &&
8 event.acceleration.y == 2 && 7 event.acceleration.y == 2 &&
9 event.acceleration.z == 3 && 8 event.acceleration.z == 3 &&
10 event.accelerationIncludingGravity.x == 4 && 9 event.accelerationIncludingGravity.x == 4 &&
11 event.accelerationIncludingGravity.y == 5 && 10 event.accelerationIncludingGravity.y == 5 &&
12 event.accelerationIncludingGravity.z == 6 && 11 event.accelerationIncludingGravity.z == 6 &&
13 event.rotationRate.alpha == 7 && 12 event.rotationRate.alpha == 7 &&
14 event.rotationRate.beta == 8 && 13 event.rotationRate.beta == 8 &&
15 event.rotationRate.gamma == 9 && 14 event.rotationRate.gamma == 9 &&
16 event.interval == expectedInterval; 15 event.interval == 100;
17 } 16 }
18 17
19 function onMotion(event) { 18 function onMotion(event) {
20 if (checkMotionEvent(event)) { 19 if (checkMotionEvent(event)) {
21 window.removeEventListener('devicemotion', onMotion); 20 window.removeEventListener('devicemotion', onMotion);
22 pass(); 21 pass();
23 } else { 22 } else {
24 fail(); 23 fail();
25 } 24 }
26 } 25 }
27 26
28 function pass() { 27 function pass() {
29 document.getElementById('status').innerHTML = 'PASS'; 28 document.getElementById('status').innerHTML = 'PASS';
30 document.location = '#pass'; 29 document.location = '#pass';
31 } 30 }
32 31
33 function fail() { 32 function fail() {
34 document.location = '#fail'; 33 document.location = '#fail';
35 } 34 }
36 </script> 35 </script>
37 </head> 36 </head>
38 <body onLoad="window.addEventListener('devicemotion', onMotion)"> 37 <body onLoad="window.addEventListener('devicemotion', onMotion)">
39 <div id="status">FAIL</div> 38 <div id="status">FAIL</div>
40 </body> 39 </body>
41 </html> 40 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698