Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html

Issue 1190293002: Have ScreenOrientationController use a timer for async event dispatch again (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add clarifying comment to test Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..087f4898a6adc6b6bc5e22119fdc8035f922261d
--- /dev/null
+++ b/LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html
@@ -0,0 +1,30 @@
+<!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 () {
+ // Force the creation of a ScreenOrientation and register it
+ // with the controller, so that orientationchange events are sent.
+ var currentType = window.screen.orientation.type;
+ testIframe.src = "resources/iframe-listen-orientation-change-detach.html";
+});
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698