diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 10:50:56 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 10:50:56 +0000 |
commit | fb630c1cdb74e955d343272a1c9b6ac2968e3a0c (patch) | |
tree | 110322fe99e57af153749ebb29f82d168014bcb1 | |
parent | 1867e84e3107c613ffe312eeef03488866d19420 (diff) | |
download | chromium_src-fb630c1cdb74e955d343272a1c9b6ac2968e3a0c.zip chromium_src-fb630c1cdb74e955d343272a1c9b6ac2968e3a0c.tar.gz chromium_src-fb630c1cdb74e955d343272a1c9b6ac2968e3a0c.tar.bz2 |
DevTools: fix flakiness of DevToolsSanityTest/TestProfilerTab.
Made a local run for 25 times, got no single failure.
BUG=http://crbug.com/21108
TEST=none
Review URL: http://codereview.chromium.org/200040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25614 0039d316-1c4b-4281-b951-d872f2087c98
-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(); }; |