| Index: LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js
|
| diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js
|
| index b42af4f60f2bc292345d18bfb0cabbc6bc48f90c..b3194a275f3b81492144557f479db672fd1b6fa2 100644
|
| --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js
|
| +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js
|
| @@ -3,9 +3,10 @@ description('Tests that adding a new event listener from a callback works as exp
|
| var mockAlpha = 1.1;
|
| var mockBeta = 2.2;
|
| var mockGamma = 3.3;
|
| +var mockAbsolute = true;
|
|
|
| if (window.testRunner)
|
| - testRunner.setMockDeviceOrientation(true, mockAlpha, true, mockBeta, true, mockGamma);
|
| + testRunner.setMockDeviceOrientation(true, mockAlpha, true, mockBeta, true, mockGamma, true, mockAbsolute);
|
| else
|
| debug('This test can not be run without the TestRunner');
|
|
|
| @@ -15,29 +16,24 @@ function checkOrientation(event) {
|
| shouldBe('deviceOrientationEvent.alpha', 'mockAlpha');
|
| shouldBe('deviceOrientationEvent.beta', 'mockBeta');
|
| shouldBe('deviceOrientationEvent.gamma', 'mockGamma');
|
| + shouldBe('deviceOrientationEvent.absolute', 'mockAbsolute');
|
| }
|
|
|
| var firstListenerEvents = 0;
|
| function firstListener(event) {
|
| checkOrientation(event);
|
| + window.removeEventListener('deviceorientation', firstListener);
|
| if (++firstListenerEvents == 1)
|
| window.addEventListener('deviceorientation', secondListener);
|
| - else if (firstListenerEvents > 2)
|
| - testFailed('Too many events for first listener.');
|
| - maybeFinishTest();
|
| }
|
|
|
| var secondListenerEvents = 0;
|
| function secondListener(event) {
|
| checkOrientation(event);
|
| - if (++secondListenerEvents > 1)
|
| - testFailed('Too many events for second listener.');
|
| - maybeFinishTest();
|
| -}
|
| -
|
| -function maybeFinishTest() {
|
| - if (firstListenerEvents == 2 && secondListenerEvents == 1)
|
| - finishJSTest();
|
| + ++secondListenerEvents;
|
| + if (firstListenerEvents != 1 || secondListenerEvents != 1)
|
| + testFailed('Too many events fired for first or second listener');
|
| + finishJSTest();
|
| }
|
|
|
| window.addEventListener('deviceorientation', firstListener);
|
|
|