Chromium Code Reviews| Index: LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html |
| diff --git a/LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html b/LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..34279044a9fb9c779f8c5a270d13194d12b086f3 |
| --- /dev/null |
| +++ b/LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html |
| @@ -0,0 +1,28 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<iframe id=testIframe></iframe> |
| +<script> |
| +var notifyTest = async_test("Test that async event dispatch to detached frame is gracefully handled."); |
| + |
| +function changeOrientationAndDetach() { |
| + // Dispatch an orientationchange event; this is handled asynchronously, |
| + // queueing a task/timer to do the actual dispatch. |
| + window.testRunner.setMockScreenOrientation('portrait-secondary'); |
| + |
| + // Detach the iframe while the event dispatch is in-flight. If |
| + // the screen orientation controller is finalized during the |
| + // detach, the async event dispatch just after will be treated |
| + // like a no-op -- there's no controller to handle the dispatch. |
| + document.body.removeChild(testIframe); |
| + setTimeout(function () { notifyTest.done(); }, 0); |
| +} |
| +notifyTest.step(function () { |
| + var currentType = window.screen.orientation.type; |
|
mlamouri (slow - plz ping)
2015/06/19 09:54:26
Could you explain the purpose of that line?
sof
2015/06/19 10:57:17
A bit magic looking; isActiveAndVisible() will onl
sof
2015/06/19 10:59:58
Added a comment.
|
| + testIframe.src = "resources/iframe-listen-orientation-change-detach.html"; |
| +}); |
| +</script> |
| +</body> |
| +</html> |