From 2494ce79f9e4db44891bbbb36336840d3f02fbcb Mon Sep 17 00:00:00 2001 From: Iain Merrick Date: Thu, 16 Sep 2010 11:04:41 +0100 Subject: Merge WebKit at r67178 : Cherry-pick fix for DeviceOrientation test. Bug in fast/dom/DeviceOrientation/add-listener-from-callback. To ensure we get a clean merge with no LayoutTest failures, cherry-picking fix from http://trac.webkit.org/changeset/67557 Change-Id: I381b0cc695eb7f05768c30b790d66318c5369af3 --- .../add-listener-from-callback-expected.txt | 18 +++++++-------- .../script-tests/add-listener-from-callback.js | 26 ++++++++++------------ 2 files changed, 21 insertions(+), 23 deletions(-) (limited to 'LayoutTests/fast') diff --git a/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt index 6bf84d4..1d2ac5a 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt +++ b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt @@ -3,15 +3,15 @@ Tests that adding a new event listener from a callback works as expected. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS deviceOrientationEvent.alpha is mockEvent.alpha -PASS deviceOrientationEvent.beta is mockEvent.beta -PASS deviceOrientationEvent.gamma is mockEvent.gamma -PASS deviceOrientationEvent.alpha is mockEvent.alpha -PASS deviceOrientationEvent.beta is mockEvent.beta -PASS deviceOrientationEvent.gamma is mockEvent.gamma -PASS deviceOrientationEvent.alpha is mockEvent.alpha -PASS deviceOrientationEvent.beta is mockEvent.beta -PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockAlpha +PASS deviceOrientationEvent.beta is mockBeta +PASS deviceOrientationEvent.gamma is mockGamma +PASS deviceOrientationEvent.alpha is mockAlpha +PASS deviceOrientationEvent.beta is mockBeta +PASS deviceOrientationEvent.gamma is mockGamma +PASS deviceOrientationEvent.alpha is mockAlpha +PASS deviceOrientationEvent.beta is mockBeta +PASS deviceOrientationEvent.gamma is mockGamma PASS successfullyParsed is true TEST COMPLETE 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 381b89c..c9c6ac9 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 @@ -1,30 +1,29 @@ description('Tests that adding a new event listener from a callback works as expected.'); -var mockEvent; -function setMockOrientation(alpha, beta, gamma) { - mockEvent = {alpha: alpha, beta: beta, gamma: gamma}; - if (window.layoutTestController) - layoutTestController.setMockDeviceOrientation(true, mockEvent.alpha, true, mockEvent.beta, true, mockEvent.gamma); - else - debug('This test can not be run without the LayoutTestController'); -} +var mockAlpha = 1.1; +var mockBeta = 2.2; +var mockGamma = 3.3; + +if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation(true, mockAlpha, true, mockBeta, true, mockGamma); +else + debug('This test can not be run without the LayoutTestController'); var deviceOrientationEvent; function checkOrientation(event) { deviceOrientationEvent = event; - shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); - shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); - shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); + shouldBe('deviceOrientationEvent.alpha', 'mockAlpha'); + shouldBe('deviceOrientationEvent.beta', 'mockBeta'); + shouldBe('deviceOrientationEvent.gamma', 'mockGamma'); } var firstListenerEvents = 0; function firstListener(event) { checkOrientation(event); if (++firstListenerEvents == 1) - setMockOrientation(11.1, 22.2, 33.3); + window.addEventListener('deviceorientation', secondListener); else if (firstListenerEvents > 2) testFailed('Too many events for first listener.'); - window.addEventListener('deviceorientation', secondListener); maybeFinishTest(); } @@ -41,7 +40,6 @@ function maybeFinishTest() { finishJSTest(); } -setMockOrientation(1.1, 2.2, 3.3); window.addEventListener('deviceorientation', firstListener); window.jsTestIsAsync = true; -- cgit v1.1