diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 15:09:01 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 15:09:01 +0000 |
commit | 6a914a59965413063517489060131b1627e6fdff (patch) | |
tree | 27d301e7365e335798b3aa7893c8594b95964242 /webkit | |
parent | 5d282b13a284b8217240fb5156251dc23aaaf944 (diff) | |
download | chromium_src-6a914a59965413063517489060131b1627e6fdff.zip chromium_src-6a914a59965413063517489060131b1627e6fdff.tar.gz chromium_src-6a914a59965413063517489060131b1627e6fdff.tar.bz2 |
DevTools Profiler: add sanity test.
Add a test that opens a page which executes JS, profiles it, and checks the result displayed.
BUG=none
TEST=chrome\browser\debugger\devtools_sanity_unittest.cc
Review URL: http://codereview.chromium.org/147204
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19360 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/js/tests.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js index 94164bd..95e76cb 100644 --- a/webkit/glue/devtools/js/tests.js +++ b/webkit/glue/devtools/js/tests.js @@ -204,6 +204,40 @@ TestSuite.prototype.testEnableResourcesTab = function(controller) { }; +/** + * Test that profiler works. + */ +TestSuite.prototype.testProfilerTab = function(controller) { + var panel = WebInspector.panels.profiles; + WebInspector.panels.elements.hide(); + panel.show(); + + var oldAddProfile = WebInspector.addProfile; + WebInspector.addProfile = function(profile) { + WebInspector.addProfile = oldAddProfile; + oldAddProfile.call(this, profile); + + panel.showProfile(profile); + var node = panel.visibleView.profileDataGridTree.children[0]; + // Iterate over displayed functions and search for a 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) { + controller.reportOk(); + } + node = node.traverseNextNode(true, null, true); + } + + controller.reportFailure(); + }; + + InspectorController.startProfiling(); + window.setTimeout('InspectorController.stopProfiling();', 1000); + controller.takeControl(); +}; + + var uiTests = new TestSuite(); |