Chromium Code Reviews| Index: LayoutTests/screen_orientation/lockOrientation-bad-array-argument.html |
| diff --git a/LayoutTests/screen_orientation/lockOrientation-bad-array-argument.html b/LayoutTests/screen_orientation/lockOrientation-bad-array-argument.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..541cc968f30f5b9d3800b84f47aad4a1b3d5bc71 |
| --- /dev/null |
| +++ b/LayoutTests/screen_orientation/lockOrientation-bad-array-argument.html |
| @@ -0,0 +1,52 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../resources/js-test.js"></script> |
| +<script> |
| +description("Validates that lockOrientation() can take an array in argument."); |
| +window.jsTestIsAsync = true; |
| + |
| +var orientationChangeCount = 0; |
| +var currentTestOrientation = 0; |
| +var testOrientations = [ |
| + "portrait-secondary", |
| + "landscape-primary", |
| + "landscape-secondary", |
| + "portrait-primary" |
| +]; |
| + |
| +function testComplete() { |
| + screen.unlockOrientation(); |
| + internals.setScreenOrientation(document, "portrait-primary"); |
| + finishJSTest(); |
| +} |
| + |
| +var testEvent; |
| +function onOrientationChangeEvent(ev) { |
| + ++orientationChangeCount; |
| + testEvent = ev; |
| + |
| + testPassed("Received an 'orientationchange' event."); |
| + shouldBeEqualToString("testEvent.type", "orientationchange"); |
| + shouldBe("orientationChangeCount", "1"); |
| + shouldBeEqualToString("screen.orientation", "landscape-primary"); |
| + testComplete(); |
| +} |
| + |
| +function changeOrientation() { |
| + internals.setScreenOrientation(document, testOrientations[currentTestOrientation++]); |
| + if (currentTestOrientation < testOrientations.length) |
| + setTimeout(changeOrientation, 100); |
| +} |
| + |
| +internals.setScreenOrientationClientMock(document); |
| +screen.addEventListener("orientationchange", onOrientationChangeEvent); |
| + |
| +shouldBeEqualToString("screen.orientation", "portrait-primary"); |
| +// Bad argument to lockOrientation(), we should not get locked. |
| +shouldBeFalse("screen.lockOrientation(['portrait-primary', 'invalid-orientation'])"); |
|
mlamouri (slow - plz ping)
2014/02/12 20:11:26
Maybe you could test that false is returned with d
Inactive
2014/02/12 21:08:04
Done.
|
| +debug("Faking device screen orientation change to 'landscape-primary'..."); |
| +internals.setScreenOrientation(document, "landscape-primary"); |
| +</script> |
| +</body> |
| +</html> |