Title: [144755] trunk/Source/WebKit/chromium
Revision
144755
Author
[email protected]
Date
2013-03-05 06:06:28 -0800 (Tue, 05 Mar 2013)

Log Message

Web Inspector: Add a renderer process memory size test.
https://bugs.webkit.org/show_bug.cgi?id=111337

Patch by Alexei Filippov <[email protected]> on 2013-03-05
Reviewed by Yury Semikhatsky.

The test checks that the renderer process memory size
is obtained from the browser and reported to the inspector
frontend correctly.

* src/js/Tests.js:
(.TestSuite.prototype.testRendererProcessNativeMemorySize.checkFuzzyValue):
(.TestSuite.prototype.testRendererProcessNativeMemorySize.step2):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (144754 => 144755)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-03-05 13:58:11 UTC (rev 144754)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-03-05 14:06:28 UTC (rev 144755)
@@ -1,3 +1,18 @@
+2013-03-05  Alexei Filippov  <[email protected]>
+
+        Web Inspector: Add a renderer process memory size test.
+        https://bugs.webkit.org/show_bug.cgi?id=111337
+
+        Reviewed by Yury Semikhatsky.
+
+        The test checks that the renderer process memory size
+        is obtained from the browser and reported to the inspector
+        frontend correctly.
+
+        * src/js/Tests.js:
+        (.TestSuite.prototype.testRendererProcessNativeMemorySize.checkFuzzyValue):
+        (.TestSuite.prototype.testRendererProcessNativeMemorySize.step2):
+
 2013-03-04  Chris Fleizach  <[email protected]>
 
         AX: cellForColumnAndRow fails for tables with hidden table cells

Modified: trunk/Source/WebKit/chromium/src/js/Tests.js (144754 => 144755)


--- trunk/Source/WebKit/chromium/src/js/Tests.js	2013-03-05 13:58:11 UTC (rev 144754)
+++ trunk/Source/WebKit/chromium/src/js/Tests.js	2013-03-05 14:06:28 UTC (rev 144755)
@@ -306,6 +306,54 @@
 
 
 /**
+ * Tests renderer process memory size obtained and passed to inspector
+ * successfully.
+ */
+TestSuite.prototype.testRendererProcessNativeMemorySize = function()
+{
+    var test = this;
+    var KB = 1024;
+    var MB = KB * KB;
+    var arraySize = 20000000;
+    var initialSize;
+
+    function checkFuzzyValue(value, expected, allowedDelta)
+    {
+        var relativeDiff = Math.abs(value - expected) / expected;
+        if (relativeDiff > allowedDelta)
+            test.fail("Value (" + value + ") differs from expected (" + expected + ") by more than " + (allowedDelta * 100) + "%.");
+    }
+
+    function step1(error, memoryBlock)
+    {
+        test.assertTrue(!error, "An error has occurred: " + error);
+        test.assertTrue(memoryBlock.size > 1 * MB && memoryBlock.size < 1500 * MB, "Unfeasible process size.");
+
+        initialSize = memoryBlock.size;
+
+        test.evaluateInConsole_("var a = new Uint8Array(" + arraySize + ");", function() {});
+
+        MemoryAgent.getProcessMemoryDistribution(false, step2);
+    }
+
+    function step2(error, memoryBlock)
+    {
+        test.assertTrue(!error, "An error has occurred: " + error);
+        var deltaBytes = memoryBlock.size - initialSize;
+        // Checks that the process size has grown approximately by
+        // the size of the allocated array (within 10% confidence interval).
+        checkFuzzyValue(deltaBytes, arraySize, 0.1);
+
+        test.releaseControl();
+    }
+
+    MemoryAgent.getProcessMemoryDistribution(false, step1);
+
+    this.takeControl();
+};
+
+
+/**
  * Tests that scripts are not duplicaed on Scripts tab switch.
  */
 TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to