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

Unified Diff: LayoutTests/netinfo/gc-frame-listeners.html

Issue 291203002: Adds NetInfo v3 Web API to Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@netinfo1
Patch Set: Comment typo Created 6 years, 7 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/netinfo/gc-frame-listeners.html
diff --git a/LayoutTests/netinfo/gc-frame-listeners.html b/LayoutTests/netinfo/gc-frame-listeners.html
new file mode 100644
index 0000000000000000000000000000000000000000..10ec4fb82fc8bd698b73ada8174b9d071dd83fdf
--- /dev/null
+++ b/LayoutTests/netinfo/gc-frame-listeners.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<head>
+<script src="../resources/js-test.js"></script>
+<script src="resources/netinfo_common.js"></script>
+</head>
+<body>
+<script>
+
+description('Tests that listeners in closed frames are collected.');
+
+shouldBe('typeof window.internals.observeGC', '"function"',
+'this test requires window.internals');
+
+var childFrame = document.createElement('iframe');
+var childFrameObserver = internals.observeGC(childFrame);
+
+document.body.appendChild(childFrame);
+
+var childConnection = childFrame.contentWindow.navigator.connection;
+var childConnectionObserver = internals.observeGC(childConnection);
+
+var callback = function(e) {
+ testFailed("Should not get here.");
+};
+var callbackObserver = internals.observeGC(callback);
+
+// Add the event listener and make sure it doesn't get collected.
+childConnection.addEventListener('typechange', callback);
+childConnection = null;
+callback = null;
+gc();
+childFrame.contentWindow.gc();
+shouldBeFalse('childFrameObserver.wasCollected');
+shouldBeFalse('childConnectionObserver.wasCollected');
+shouldBeFalse('callbackObserver.wasCollected');
+
+document.body.removeChild(childFrame);
+childFrame = null;
+gc();
+shouldBeTrue('childFrameObserver.wasCollected');
+shouldBeTrue('childConnectionObserver.wasCollected');
+shouldBeTrue('callbackObserver.wasCollected');
+
+finishJSTest();
+
+</script>
+</body>
+</html>
« no previous file with comments | « LayoutTests/netinfo/basic-operation-expected.txt ('k') | LayoutTests/netinfo/gc-frame-listeners-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698