author | Mike Hommey <mh+mozilla@glandium.org> |
Tue, 09 Oct 2012 10:17:27 +0200 | |
changeset 109729 | aee9b902040882e31732d3063647862470828c0d |
parent 109728 | b992224cdd55d70e0bec80c68da428eeb7d3688e |
child 109730 | 55585f89f069054b65fc464d8ba144cdb45459d3 |
push id | 23652 |
push user | ryanvm@gmail.com |
push date | Wed, 10 Oct 2012 01:10:20 +0000 |
treeherder | mozilla-central@5cca0408a73f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | past |
bugs | 799323, 793672 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
toolkit/devtools/debugger/tests/unit/test_profiler_actor.js | file | annotate | diff | comparison | revisions |
--- a/toolkit/devtools/debugger/tests/unit/test_profiler_actor.js +++ b/toolkit/devtools/debugger/tests/unit/test_profiler_actor.js @@ -109,26 +109,33 @@ function test_profile(aClient, aProfiler do_check_eq(typeof aResponse.profile, "object"); do_check_eq(typeof aResponse.profile.meta, "object"); do_check_eq(typeof aResponse.profile.meta.platform, "string"); do_check_eq(typeof aResponse.profile.threads, "object"); do_check_eq(typeof aResponse.profile.threads[0], "object"); do_check_eq(typeof aResponse.profile.threads[0].samples, "object"); do_check_neq(aResponse.profile.threads[0].samples.length, 0); - // A sample around the middle of the list is expected to have been - // in the busy wait above. - var sample = aResponse.profile.threads[0].samples[Math.floor(aResponse.profile.threads[0].samples.length / 2)]; - do_check_eq(sample.name, "(root)"); - do_check_eq(typeof sample.frames, "object"); - do_check_neq(sample.frames.length, 0); - do_check_true(sample.frames.some(function(f) { - return (f.line == stack.lineNumber) && - (f.location == stack.name + " (" + stack.filename + ":" + funcLine + ")"); - })); + function some(array, cb) { + for (var i = array.length; i; i--) { + if (cb(array[i - 1])) + return true; + } + return false; + } + // At least one sample is expected to have been in the busy wait above. + do_check_true(some(aResponse.profile.threads[0].samples, function(sample) { + return sample.name == "(root)" && + typeof sample.frames == "object" && + sample.frames.length != 0 && + sample.frames.some(function(f) { + return (f.line == stack.lineNumber) && + (f.location == stack.name + " (" + stack.filename + ":" + funcLine + ")"); + }); + })); aClient.request({ to: aProfiler, type: "stopProfiler" }, function (aResponse) { do_check_eq(typeof aResponse.msg, "string"); aClient.request({ to: aProfiler, type: "isActive" }, function (aResponse) { do_check_false(aResponse.isActive); aClient.close(function() { test_profiler_status(); });