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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/DeviceOrientation/updates.html

Issue 2677603003: Move DeviceMotion and DeviceOrientation out from fast/dom/. (Closed)
Patch Set: device_orientation Created 3 years, 10 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 <html>
3 <body>
4 <script src="../../../resources/js-test.js"></script>
5 <script>
6 description('Tests that updates to the orientation causes new events to fire.');
7
8 var mockEvent;
9 function setMockOrientation(alpha, beta, gamma, absolute) {
10 mockEvent = {alpha: alpha, beta: beta, gamma: gamma, absolute: absolute};
11 if (window.testRunner)
12 testRunner.setMockDeviceOrientation(true, mockEvent.alpha, true, mockEve nt.beta, true, mockEvent.gamma, mockEvent.absolute);
13 else
14 debug('This test can not be run without the TestRunner');
15 }
16
17 var deviceOrientationEvent;
18 function checkOrientation(event) {
19 deviceOrientationEvent = event;
20 shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha');
21 shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta');
22 shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma');
23 shouldBe('deviceOrientationEvent.absolute', 'mockEvent.absolute');
24 }
25
26 function firstListener(event) {
27 checkOrientation(event);
28 window.removeEventListener('deviceorientation', firstListener);
29 setTimeout(function(){initUpdateListener();}, 0);
30 }
31
32 function initUpdateListener() {
33 setMockOrientation(11.1, 22.2, 33.3, true);
34 window.addEventListener('deviceorientation', updateListener);
35 }
36
37 function updateListener(event) {
38 checkOrientation(event);
39 finishJSTest();
40 }
41
42 setMockOrientation(1.1, 2.2, 3.3, true);
43 window.addEventListener('deviceorientation', firstListener);
44
45 window.jsTestIsAsync = true;
46 </script>
47 </body>
48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698