Chromium Code Reviews| Index: LayoutTests/screen_orientation/locked-no-orientation-change-event.html |
| diff --git a/LayoutTests/screen_orientation/locked-no-orientation-change-event.html b/LayoutTests/screen_orientation/locked-no-orientation-change-event.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0db2d0f5d2f08861bb39c71863c6df66194db440 |
| --- /dev/null |
| +++ b/LayoutTests/screen_orientation/locked-no-orientation-change-event.html |
| @@ -0,0 +1,52 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../resources/js-test.js"></script> |
| +<script> |
| +description("Validates that no orientationchange event is fired when we are locked."); |
|
mlamouri (slow - plz ping)
2014/02/12 20:11:26
This test seems to essentially test the mock objec
Inactive
2014/02/12 21:08:04
So you want to remove this layout test?
mlamouri (slow - plz ping)
2014/02/13 16:12:08
I guess we could remove it yes. There is no point
Inactive
2014/02/13 17:03:24
Done.
|
| +window.jsTestIsAsync = true; |
| + |
| +var orientationChangeCount = 0; |
| +var currentTestOrientation = 0; |
| +var testOrientations = [ |
| + "portrait-secondary", |
| + "landscape-primary", |
| + "landscape-secondary", |
| + "portrait-primary" |
| +]; |
| + |
| +function testComplete() { |
| + screen.unlockOrientation(); |
| + finishJSTest(); |
| +} |
| + |
| +function onOrientationChangeEvent(ev) { |
| + ++orientationChangeCount; |
| + testFailed("Unexpected 'orientationchange' event."); |
| +} |
| + |
| +function changeOrientation() { |
| + shouldBeEqualToString("screen.orientation", "portrait-primary"); |
| + if (currentTestOrientation == testOrientations.length) { |
| + if (orientationChangeCount) |
| + testFailed("Received " + orientationChangeCount + " unexpected 'orientationchange' event(s)."); |
| + else |
| + testPassed("Received no 'orientationchange' event, as expected."); |
| + testComplete(); |
| + return; |
| + } |
| + debug("Faking device screen orientation change to '" + testOrientations[currentTestOrientation] +"'..."); |
| + internals.setScreenOrientation(document, testOrientations[currentTestOrientation++]); |
| + setTimeout(changeOrientation, 100); |
| +} |
| + |
| +internals.setScreenOrientationClientMock(document); |
| +screen.addEventListener("orientationchange", onOrientationChangeEvent); |
| + |
| +shouldBeEqualToString("screen.orientation", "portrait-primary"); |
| +debug("locking orientation to 'portrait-primary'."); |
| +shouldBeTrue("screen.lockOrientation('portrait-primary')"); |
| +setTimeout(changeOrientation, 100); |
| +</script> |
| +</body> |
| +</html> |