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

Side by Side Diff: test/cctest/test-cpu-profiler.cc

Issue 24220003: Remove default isolate usage from almost all tests (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid2)); 389 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid2));
390 CHECK_EQ(p3, FindCpuProfile(cpu_profiler, uid3)); 390 CHECK_EQ(p3, FindCpuProfile(cpu_profiler, uid3));
391 const_cast<v8::CpuProfile*>(p3)->Delete(); 391 const_cast<v8::CpuProfile*>(p3)->Delete();
392 CHECK_EQ(0, cpu_profiler->GetProfileCount()); 392 CHECK_EQ(0, cpu_profiler->GetProfileCount());
393 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid3)); 393 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid3));
394 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid2)); 394 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid2));
395 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid1)); 395 CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid1));
396 } 396 }
397 397
398 398
399 TEST(GetProfilerWhenIsolateIsNotInitialized) {
400 v8::Isolate* isolate = v8::Isolate::GetCurrent();
401 CHECK(i::Isolate::Current()->IsDefaultIsolate());
402 CHECK(!i::Isolate::Current()->IsInitialized());
403 CHECK_EQ(NULL, isolate->GetCpuProfiler());
404 {
405 v8::Isolate::Scope isolateScope(isolate);
406 LocalContext env;
407 v8::HandleScope scope(isolate);
408 CHECK_NE(NULL, isolate->GetCpuProfiler());
409 isolate->GetCpuProfiler()->StartCpuProfiling(v8::String::New("Test"));
410 isolate->GetCpuProfiler()->StopCpuProfiling(v8::String::New("Test"));
411 }
412 CHECK(i::Isolate::Current()->IsInitialized());
413 CHECK_NE(NULL, isolate->GetCpuProfiler());
414 isolate->Dispose();
415 CHECK_EQ(NULL, isolate->GetCpuProfiler());
416 }
417
418
419 TEST(ProfileStartEndTime) { 399 TEST(ProfileStartEndTime) {
420 LocalContext env; 400 LocalContext env;
421 v8::HandleScope scope(env->GetIsolate()); 401 v8::HandleScope scope(env->GetIsolate());
422 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); 402 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
423 403
424 v8::Local<v8::String> profile_name = v8::String::New("test"); 404 v8::Local<v8::String> profile_name = v8::String::New("test");
425 cpu_profiler->StartCpuProfiling(profile_name); 405 cpu_profiler->StartCpuProfiling(profile_name);
426 const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name); 406 const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
427 CHECK(profile->GetStartTime() <= profile->GetEndTime()); 407 CHECK(profile->GetStartTime() <= profile->GetEndTime());
428 } 408 }
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 CHECK_EQ(0, programNode->GetChildrenCount()); 1353 CHECK_EQ(0, programNode->GetChildrenCount());
1374 CHECK_GE(programNode->GetHitCount(), 3); 1354 CHECK_GE(programNode->GetHitCount(), 3);
1375 1355
1376 const v8::CpuProfileNode* idleNode = 1356 const v8::CpuProfileNode* idleNode =
1377 GetChild(root, ProfileGenerator::kIdleEntryName); 1357 GetChild(root, ProfileGenerator::kIdleEntryName);
1378 CHECK_EQ(0, idleNode->GetChildrenCount()); 1358 CHECK_EQ(0, idleNode->GetChildrenCount());
1379 CHECK_GE(idleNode->GetHitCount(), 3); 1359 CHECK_GE(idleNode->GetHitCount(), 3);
1380 1360
1381 cpu_profiler->DeleteAllCpuProfiles(); 1361 cpu_profiler->DeleteAllCpuProfiles();
1382 } 1362 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698