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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 <script src="resources/netinfo_common.js"></script>
5 </head>
6 <body>
7 <script>
8
9 description('Tests that listeners in closed frames are collected.');
10
11 shouldBe('typeof window.internals.observeGC', '"function"',
12 'this test requires window.internals');
13
14 var childFrame = document.createElement('iframe');
15 var childFrameObserver = internals.observeGC(childFrame);
16
17 document.body.appendChild(childFrame);
18
19 var childConnection = childFrame.contentWindow.navigator.connection;
20 var childConnectionObserver = internals.observeGC(childConnection);
21
22 var callback = function(e) {
23 testFailed("Should not get here.");
24 };
25 var callbackObserver = internals.observeGC(callback);
26
27 // Add the event listener and make sure it doesn't get collected.
28 childConnection.addEventListener('typechange', callback);
29 childConnection = null;
30 callback = null;
31 gc();
32 childFrame.contentWindow.gc();
33 shouldBeFalse('childFrameObserver.wasCollected');
34 shouldBeFalse('childConnectionObserver.wasCollected');
35 shouldBeFalse('callbackObserver.wasCollected');
36
37 document.body.removeChild(childFrame);
38 childFrame = null;
39 gc();
40 shouldBeTrue('childFrameObserver.wasCollected');
41 shouldBeTrue('childConnectionObserver.wasCollected');
42 shouldBeTrue('callbackObserver.wasCollected');
43
44 finishJSTest();
45
46 </script>
47 </body>
48 </html>
OLDNEW
« 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