|
Line 0
a/LayoutTests/inspector/profiler/memory-instrumentation-external-string.html_sec1
|
|
|
1 |
<html> |
| 2 |
<head> |
| 3 |
<script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 |
<script src="memory-instrumentation-test.js"></script> |
| 5 |
<script> |
| 6 |
function generateLongFunction() |
| 7 |
{ |
| 8 |
var source = []; |
| 9 |
source.push("function longFunction(x) {"); |
| 10 |
for (var i = 0; i < 100*1000; i++) { |
| 11 |
source.push(" x += x * i;"); |
| 12 |
} |
| 13 |
source.push("}"); |
| 14 |
var sourceString = source.join("\n"); |
| 15 |
sourceSize = sourceString.length; |
| 16 |
var script = document.createElement("script"); |
| 17 |
script.textContent = sourceString; |
| 18 |
document.head.appendChild(script); |
| 19 |
return sourceSize; |
| 20 |
} |
| 21 |
|
| 22 |
function test() |
| 23 |
{ |
| 24 |
InspectorTest.evaluateInPage("generateLongFunction()", didGenerateLongScript); |
| 25 |
function didGenerateLongScript(result) { |
| 26 |
var externalStringsExpectedMinimum = result.value; |
| 27 |
if (externalStringsExpectedMinimum < 1024 * 1024) { |
| 28 |
InspectorTest.addResult("FAIL: script is less than 1Mb: " + externalStringsExpectedMinimum); |
| 29 |
return InspectorTest.completeTest(); |
| 30 |
} |
| 31 |
InspectorTest.validateMemoryBlockSize(["ProcessPrivateMemory", "JSExternalResources"], externalStringsExpectedMinimum); |
| 32 |
} |
| 33 |
} |
| 34 |
</script> |
| 35 |
</head> |
| 36 |
|
| 37 |
<body onload="runTest()"> |
| 38 |
<p> |
| 39 |
This test checks that page's external strings size reported by the memory agent |
| 40 |
includes size of script elements.<a href="https://bugs.webkit.org/show_bug.cgi?id=113788">Bug 113788.</a> |
| 41 |
</p> |
| 42 |
</body> |
| 43 |
</html> |