Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Unified Diff: test/cctest/test-cpu-profiler.cc

Issue 17642009: CPUProfiler: propagate scriptId to the front-end (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: unnecessary line was removed Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/test-cpu-profiler.cc
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 2184122717770be2eb0203fd9933394828e7f0e5..d3e34133d86bf6fcc9005c50942949c395542150 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -468,6 +468,17 @@ static void CheckSimpleBranch(const v8::CpuProfileNode* node,
}
+static void CheckScriptIds(int scriptId, const v8::CpuProfileNode* node) {
+ v8::String::Utf8Value function_name(node->GetFunctionName());
+ if (function_name.length() && (*function_name)[0] != '(')
yurys 2013/06/25 09:16:55 Missing {}
+ CHECK_EQ(scriptId, node->GetScriptId());
+ int length = node->GetChildrenCount();
+ for (int i = 0; i < length; i++) {
+ CheckScriptIds(scriptId, node->GetChild(i));
+ }
+}
+
+
static const char* cpu_profiler_test_source = "function loop(timeout) {\n"
" this.mmm = 0;\n"
" var start = Date.now();\n"
@@ -521,7 +532,9 @@ TEST(CollectCpuProfile) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Script::Compile(v8::String::New(cpu_profiler_test_source))->Run();
+ v8::Handle<v8::Script> script =
+ v8::Script::Compile(v8::String::New(cpu_profiler_test_source));
+ script->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::New("start")));
@@ -564,6 +577,7 @@ TEST(CollectCpuProfile) {
CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch));
const char* delayBranch[] = { "delay", "loop" };
CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch));
+ CheckScriptIds(script->Id()->ToInt32()->Value(), root);
yurys 2013/06/25 09:16:55 Would be nice to have additional test for a profil
cpu_profiler->DeleteAllCpuProfiles();
}

Powered by Google App Engine
This is Rietveld 408576698