diff options
author | Iain Merrick <husky@google.com> | 2010-09-13 16:35:48 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-16 12:10:42 +0100 |
commit | 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch) | |
tree | ddce1aa5e3b6967a69691892e500897558ff8ab6 /LayoutTests/fast/dom/DeviceOrientation | |
parent | 12bec63ec71e46baba27f0bd9bd9d8067683690a (diff) | |
download | external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2 |
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'LayoutTests/fast/dom/DeviceOrientation')
19 files changed, 346 insertions, 7 deletions
diff --git a/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt new file mode 100644 index 0000000..6bf84d4 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt @@ -0,0 +1,18 @@ +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 successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback.html b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback.html new file mode 100644 index 0000000..fa338f5 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/add-listener-from-callback.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/multiple-frames-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames-expected.txt new file mode 100644 index 0000000..5f24e38 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames-expected.txt @@ -0,0 +1,15 @@ +Tests using DeviceOrientation from multiple frames. + +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 successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/multiple-frames.html b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames.html new file mode 100644 index 0000000..f0e1e89 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/multiple-frames.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events-expected.txt new file mode 100644 index 0000000..0d95dee --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events-expected.txt @@ -0,0 +1,10 @@ +Tests that events are never fired sycnhronously from a call to window.addEventListener(). + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS hasAddEventListenerReturned is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events.html b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events.html new file mode 100644 index 0000000..23ce6b2 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/no-synchronous-events.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/null-values-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/null-values-expected.txt new file mode 100644 index 0000000..cb739ae --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/null-values-expected.txt @@ -0,0 +1,21 @@ +Tests using null values for some of the event properties. + +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 mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/null-values.html b/LayoutTests/fast/dom/DeviceOrientation/null-values.html new file mode 100644 index 0000000..d21463c --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/null-values.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/null-values.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> 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 new file mode 100644 index 0000000..381b89c --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js @@ -0,0 +1,48 @@ +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 deviceOrientationEvent; +function checkOrientation(event) { + deviceOrientationEvent = event; + shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); + shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); + shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); +} + +var firstListenerEvents = 0; +function firstListener(event) { + checkOrientation(event); + if (++firstListenerEvents == 1) + setMockOrientation(11.1, 22.2, 33.3); + else if (firstListenerEvents > 2) + testFailed('Too many events for first listener.'); + window.addEventListener('deviceorientation', secondListener); + 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(); +} + +setMockOrientation(1.1, 2.2, 3.3); +window.addEventListener('deviceorientation', firstListener); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js index 6e68b06..b5ff5ba 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js @@ -1,4 +1,4 @@ -description("Tests the basic operation of DeviceOrientation using the mock."); +description('Tests the basic operation of DeviceOrientation using the mock.'); var mockAlpha = 1.1; var mockBeta = 2.2; @@ -10,7 +10,7 @@ else debug('This test can not be run without the LayoutTestController'); var deviceOrientationEvent; -window.addEventListener("deviceorientation", function(e) { +window.addEventListener('deviceorientation', function(e) { deviceOrientationEvent = e; shouldBe('deviceOrientationEvent.alpha', 'mockAlpha'); shouldBe('deviceOrientationEvent.beta', 'mockBeta'); diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js index 0fe8774..706de70 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js @@ -1,4 +1,4 @@ -description("Tests that document.createEvent() works with DeviceOrientationEvent."); +description('Tests that document.createEvent() works with DeviceOrientationEvent.'); var event = document.createEvent('DeviceOrientationEvent'); diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/multiple-frames.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/multiple-frames.js new file mode 100644 index 0000000..f8b8fb9 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/multiple-frames.js @@ -0,0 +1,43 @@ +description('Tests using DeviceOrientation from multiple frames.'); + +var deviceOrientationEvent; +function checkOrientation(event) { + deviceOrientationEvent = event; + shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); + shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); + shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); +} + +var hasMainFrameEventFired = false; +function mainFrameListener(event) { + checkOrientation(event); + hasMainFrameEventFired = true; + maybeFinishTest(); +} + +var hasChildFrameEventFired = false; +function childFrameListener(event) { + checkOrientation(event); + hasChildFrameEventFired = true; + maybeFinishTest(); +} + +function maybeFinishTest() { + if (hasMainFrameEventFired && hasChildFrameEventFired) + finishJSTest(); +} + +var mockEvent = {alpha: 1.1, beta: 2.2, gamma: 3.3}; +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 childFrame = document.createElement('iframe'); +document.body.appendChild(childFrame); +childFrame.contentWindow.addEventListener('deviceorientation', childFrameListener); + +window.addEventListener('deviceorientation', mainFrameListener); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-synchronous-events.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-synchronous-events.js new file mode 100644 index 0000000..0f4bc51 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-synchronous-events.js @@ -0,0 +1,16 @@ +description('Tests that events are never fired sycnhronously from a call to window.addEventListener().'); + +if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation(true, 1.1, true, 2.2, true, 3.3); +else + debug('This test can not be run without the LayoutTestController'); + +var hasAddEventListenerReturned = false; +window.addEventListener('deviceorientation', function() { + shouldBeTrue('hasAddEventListenerReturned'); + finishJSTest(); +}); +hasAddEventListenerReturned = true; + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js new file mode 100644 index 0000000..ccde66a --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js @@ -0,0 +1,56 @@ +description('Tests using null values for some of the event properties.'); + +var mockEvent; +function setMockOrientation(alpha, beta, gamma) { + mockEvent = {alpha: alpha, beta: beta, gamma: gamma}; + if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation( + null != mockEvent.alpha, null == mockEvent.alpha ? 0 : mockEvent.alpha, + null != mockEvent.beta, null == mockEvent.beta ? 0 : mockEvent.beta, + null != mockEvent.gamma, null == mockEvent.gamma ? 0 : mockEvent.gamma); + 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'); +} + +function firstListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', firstListener); + + setMockOrientation(1.1, null, null); + window.addEventListener('deviceorientation', secondListener); +} + +function secondListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', secondListener); + + setMockOrientation(null, 2.2, null); + window.addEventListener('deviceorientation', thirdListener); +} + +function thirdListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', thirdListener); + + setMockOrientation(null, null, 3.3); + window.addEventListener('deviceorientation', fourthListener); +} + +function fourthListener(event) { + checkOrientation(event); + finishJSTest(); +} + +setMockOrientation(null, null, null); +window.addEventListener('deviceorientation', firstListener); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js index 2936e72..900c94b 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js @@ -1,4 +1,4 @@ -description("Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined."); +description('Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined.'); var event; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/updates.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/updates.js new file mode 100644 index 0000000..f5ec029 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/updates.js @@ -0,0 +1,37 @@ +description('Tests that updates to the orientation causes new events to fire.'); + +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 deviceOrientationEvent; +function checkOrientation(event) { + deviceOrientationEvent = event; + shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); + shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); + shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); +} + +function firstListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', firstListener); + + setMockOrientation(11.1, 22.2, 33.3); + window.addEventListener('deviceorientation', updateListener); +} + +function updateListener(event) { + checkOrientation(event); + finishJSTest(); +} + +setMockOrientation(1.1, 2.2, 3.3); +window.addEventListener('deviceorientation', firstListener); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js index 8e65059..885932b 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js @@ -1,9 +1,9 @@ -description("Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present."); +description('Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present.'); function hasDeviceOrientationEventProperty() { for (var property in window) { - if (property == "DeviceOrientationEvent") + if (property == 'DeviceOrientationEvent') return true; } return false; @@ -18,7 +18,7 @@ shouldBeTrue("window.hasOwnProperty('DeviceOrientationEvent')"); function hasOnDeviceOrientationProperty() { for (var property in window) { - if (property == "ondeviceorientation") + if (property == 'ondeviceorientation') return true; } return false; diff --git a/LayoutTests/fast/dom/DeviceOrientation/updates-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/updates-expected.txt new file mode 100644 index 0000000..6e54f16 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/updates-expected.txt @@ -0,0 +1,15 @@ +Tests that updates to the orientation causes new events to fire. + +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 successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/updates.html b/LayoutTests/fast/dom/DeviceOrientation/updates.html new file mode 100644 index 0000000..5f2ac3c --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/updates.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/updates.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> |