diff options
-rw-r--r-- | chrome/browser/debugger/devtools_sanity_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/test/data/devtools/js_page.html | 17 | ||||
-rw-r--r-- | webkit/glue/devtools/js/tests.js | 16 |
3 files changed, 30 insertions, 6 deletions
diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index 80f043d..bb38583 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -145,8 +145,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestResourceHeaders) { } // Tests profiler panel. -// Flaky, http://crbug.com/21108 -IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, DISABLED_TestProfilerTab) { +IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestProfilerTab) { RunTest("testProfilerTab", kJsPage); } diff --git a/chrome/test/data/devtools/js_page.html b/chrome/test/data/devtools/js_page.html index 86267ef..1fde9fe 100644 --- a/chrome/test/data/devtools/js_page.html +++ b/chrome/test/data/devtools/js_page.html @@ -6,10 +6,23 @@ } function eternal_fib() { - window.setTimeout("fib(20); eternal_fib();", 0); + var started = Date.now(); + while(true) { + fib(20); + // Make page responsive by making a break every 100 ms. + if (Date.now() - started >= 100) { + setTimeout(eternal_fib, 0); + return; + } + } + } + + function load() { + // Let the page do initial rendering, then go. + setTimeout(eternal_fib, 200); } </script> </head> - <body onload="eternal_fib()"> + <body onload="load()"> </body> </html> diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js index 41141fc..5691017 100644 --- a/webkit/glue/devtools/js/tests.js +++ b/webkit/glue/devtools/js/tests.js @@ -320,7 +320,7 @@ TestSuite.prototype.testProfilerTab = function() { // that is called 'fib' or 'eternal_fib'. If found, it will mean // that we actually have profiled page's code. while (node) { - if (node.functionName.indexOf("fib") != -1) { + if (node.functionName.indexOf('fib') != -1) { test.releaseControl(); } node = node.traverseNextNode(true, null, true); @@ -328,9 +328,21 @@ TestSuite.prototype.testProfilerTab = function() { test.fail(); }); + var ticksCount = 0; + var tickRecord = '\nt,'; + this.addSniffer(RemoteDebuggerAgent, 'DidGetNextLogLines', + function(log) { + var pos = 0; + while ((pos = log.indexOf(tickRecord, pos)) != -1) { + pos += tickRecord.length; + ticksCount++; + } + if (ticksCount > 100) { + InspectorController.stopProfiling(); + } + }, true); InspectorController.startProfiling(); - window.setTimeout('InspectorController.stopProfiling();', 1000); this.takeControl(); }; |