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

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

Issue 10827415: Chromium-side implementation of DeviceMotion. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test should set the kEnableDeviceMotion flag Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <title>DeviceMotion test</title>
4 <script type="text/javascript">
5 var eventCount = 0;
6
7 function checkMotionEvent(event) {
8 // Return true iff the motion is close enough to
9 // (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).
10 return Math.abs(event.acceleration.x - 1) < 0.01 &&
11 Math.abs(event.acceleration.y - 2) < 0.01 &&
12 Math.abs(event.acceleration.z - 3) < 0.01 &&
13 Math.abs(event.accelerationIncludingGravity.x - 4) < 0.01 &&
14 Math.abs(event.accelerationIncludingGravity.y - 5) < 0.01 &&
15 Math.abs(event.accelerationIncludingGravity.z - 6) < 0.01 &&
16 Math.abs(event.rotationRate.alpha - 7) < 0.01 &&
17 Math.abs(event.rotationRate.beta - 8) < 0.01 &&
18 Math.abs(event.rotationRate.gamma - 9) < 0.01 &&
19 Math.abs(event.interval - 10) < 0.01;
20 }
21
22 function onMotion(event) {
23 if (checkMotionEvent(event)) {
24 window.removeEventListener('devicemotion', onMotion);
25 pass();
26 } else {
27 fail();
28 }
29 }
30
31 function pass() {
32 document.getElementById('status').innerHTML = 'PASS';
33 document.location = '#pass';
34 }
35
36 function fail() {
37 document.location = '#fail';
38 }
39 </script>
40 </head>
41 <body onLoad="window.addEventListener('devicemotion', onMotion)">
42 <div id="status">FAIL</div>
43 </body>
44 </html>
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | webkit/support/test_webkit_platform_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698