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

Side by Side Diff: LayoutTests/netinfo/gc-unused-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 unused listeners are collected.');
10
11 shouldBe('typeof window.internals.observeGC', '"function"',
12 'this test requires window.internals');
13
14 var callback = function(e) {
15 testFailed("Should not get here.");
16 };
17
18 // Add a listener.
19 var callbackObserver = internals.observeGC(callback);
20 connection.addEventListener('typechange', callback);
21 gc();
22 shouldBeFalse('callbackObserver.wasCollected');
23
24 // Remove the listener and its callback reference.
25 connection.removeEventListener('typechange', callback);
26 callback = null;
27 gc();
28 shouldBeTrue('callbackObserver.wasCollected');
29 finishJSTest();
30
31 </script>
32 </body>
33 </html>
OLDNEW
« no previous file with comments | « LayoutTests/netinfo/gc-frame-listeners-expected.txt ('k') | LayoutTests/netinfo/gc-unused-listeners-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698