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

Side by Side Diff: LayoutTests/resources/leak-check.js

Issue 206453010: NavigationAction should not retain Event. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // include resources/js-test.js before this file. 1 // include resources/js-test.js before this file.
2 2
3 function getCounterValues() {
4 testRunner.resetTestHelperControllers();
5 gc();
6
7 var ret = {'numberOfLiveDocuments': window.internals.numberOfLiveDocuments() };
8
9 var refCountedInstances = JSON.parse(window.internals.dumpRefCountedInstance Counts());
10 for (typename in refCountedInstances)
11 ret['numberOfInstances-'+typename] = refCountedInstances[typename];
12
13 return ret;
14 }
15
16 function compareValues(countersBefore, countersAfter, tolerance) {
17 for (type in tolerance) {
18 var before = countersBefore[type];
19 var after = countersAfter[type];
20
21 if (after - before <= tolerance[type])
22 testPassed('The difference of counter "'+type+'" before and after th e cycle is under the threshold of '+tolerance[type]+'.');
23 else
24 testFailed('counter "'+type+'" was '+before+' before and now '+after +' after the cycle. This exceeds the threshold of '+tolerance[type]+'.');
25 }
26 }
27
3 function doLeakTest(src, tolerance) { 28 function doLeakTest(src, tolerance) {
4 function getCounterValues() {
5 testRunner.resetTestHelperControllers();
6 gc();
7
8 var ret = {'numberOfLiveDocuments': window.internals.numberOfLiveDocumen ts()};
9
10 var refCountedInstances = JSON.parse(window.internals.dumpRefCountedInst anceCounts());
11 for (typename in refCountedInstances)
12 ret['numberOfInstances-'+typename] = refCountedInstances[typename];
13
14 return ret;
15 }
16
17 var frame = document.createElement('iframe'); 29 var frame = document.createElement('iframe');
18 document.body.appendChild(frame); 30 document.body.appendChild(frame);
19 function loadSourceIntoIframe(src, callback) { 31 function loadSourceIntoIframe(src, callback) {
20 var originalSrc = frame.src; 32 var originalSrc = frame.src;
21 33
22 frame.onload = function() { 34 frame.onload = function() {
23 if (frame.src === originalSrc) 35 if (frame.src === originalSrc)
24 return true; 36 return true;
25 37
26 callback(); 38 callback();
27 return true; 39 return true;
28 }; 40 };
29 frame.src = src; 41 frame.src = src;
30 } 42 }
31 43
32 function compareValues(countersBefore, countersAfter, tolerance) {
33 for (type in tolerance) {
34 var before = countersBefore[type];
35 var after = countersAfter[type];
36
37 if (after - before <= tolerance[type])
38 testPassed('The difference of counter "'+type+'" before and afte r the cycle is under the threshold of '+tolerance[type]+'.');
39 else
40 testFailed('counter "'+type+'" was '+before+' before and now '+a fter+' after the cycle. This exceeds the threshold of '+tolerance[type]+'.');
41 }
42 }
43
44 jsTestIsAsync = true; 44 jsTestIsAsync = true;
45 if (!window.internals) { 45 if (!window.internals) {
46 debug("This test only runs on DumpRenderTree, as it requires existence o f window.internals and cross-domain resource access check disabled."); 46 debug("This test only runs on DumpRenderTree, as it requires existence o f window.internals and cross-domain resource access check disabled.");
47 finishJSTest(); 47 finishJSTest();
48 } 48 }
49 49
50 loadSourceIntoIframe('about:blank', function() { 50 loadSourceIntoIframe('about:blank', function() {
51 // blank document loaded... 51 // blank document loaded...
52 var countersBefore = getCounterValues(); 52 var countersBefore = getCounterValues();
53 53
(...skipping 18 matching lines...) Expand all
72 72
73 function htmlToUrl(html) { 73 function htmlToUrl(html) {
74 return 'data:text/html;charset=utf-8,' + html; 74 return 'data:text/html;charset=utf-8,' + html;
75 } 75 }
76 76
77 function grabScriptText(id) { 77 function grabScriptText(id) {
78 return document.getElementById(id).innerText; 78 return document.getElementById(id).innerText;
79 } 79 }
80 80
81 // include fast/js/resources/js-test-post.js after this file. 81 // include fast/js/resources/js-test-post.js after this file.
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/resources/notify-parent.html ('k') | Source/core/loader/NavigationAction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698