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

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

Issue 16035027: DevTools: CPUProfiler: provide url for scripts that have sourceURL property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: test was added 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
« src/handles.cc ('K') | « src/log.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-cpu-profiler.cc
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 188fbd948066ade0def73c4c894d1ba515aa5477..0d393c31161e1a281bc5c1524d261fa66843d1fd 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -497,7 +497,8 @@ static const char* cpu_profiler_test_source = "function loop(timeout) {\n"
" var duration = Date.now() - start;\n"
" } while (duration < timeout);\n"
" return duration;\n"
-"}\n";
+"}\n"
+"//# sourceURL=cpu_profiler_test_source.js";
// Check that the profile tree for the script above will look like the
@@ -528,15 +529,21 @@ TEST(CollectCpuProfile) {
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
v8::Local<v8::String> profile_name = v8::String::New("my_profile");
- cpu_profiler->StartCpuProfiling(profile_name);
int32_t profiling_interval_ms = 200;
#if defined(_WIN32) || defined(_WIN64)
// 200ms is not enough on Windows. See
// https://code.google.com/p/v8/issues/detail?id=2628
profiling_interval_ms = 500;
#endif
+
+ // Warm up.
v8::Handle<v8::Value> args[] = { v8::Integer::New(profiling_interval_ms) };
function->Call(env->Global(), ARRAY_SIZE(args), args);
+
+ cpu_profiler->StartCpuProfiling(profile_name);
+
+ function->Call(env->Global(), ARRAY_SIZE(args), args);
+
const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
CHECK_NE(NULL, profile);
@@ -553,6 +560,8 @@ TEST(CollectCpuProfile) {
CheckChildrenNames(root, names);
const v8::CpuProfileNode* startNode = GetChild(root, "start");
+ CHECK_EQ(v8::String::New("cpu_profiler_test_source.js"),
yurys 2013/06/11 11:23:06 I'd rather have it tested in a separate test.
+ startNode->GetScriptResourceName());
CHECK_EQ(1, startNode->GetChildrenCount());
const v8::CpuProfileNode* fooNode = GetChild(startNode, "foo");
« src/handles.cc ('K') | « src/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698