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

Side by Side Diff: test/cctest/test-api.cc

Issue 302603002: Fix mem leaks in tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 22413 matching lines...) Expand 10 before | Expand all | Expand 10 after
22424 static int last_event_status; 22424 static int last_event_status;
22425 void StoringEventLoggerCallback(const char* message, int status) { 22425 void StoringEventLoggerCallback(const char* message, int status) {
22426 last_event_message = message; 22426 last_event_message = message;
22427 last_event_status = status; 22427 last_event_status = status;
22428 } 22428 }
22429 22429
22430 22430
22431 TEST(EventLogging) { 22431 TEST(EventLogging) {
22432 v8::Isolate* isolate = CcTest::isolate(); 22432 v8::Isolate* isolate = CcTest::isolate();
22433 isolate->SetEventLogger(StoringEventLoggerCallback); 22433 isolate->SetEventLogger(StoringEventLoggerCallback);
22434 v8::internal::HistogramTimer* histogramTimer = 22434 v8::internal::HistogramTimer histogramTimer(
22435 new v8::internal::HistogramTimer( 22435 "V8.Test", 0, 10000, 50,
22436 "V8.Test", 0, 10000, 50, 22436 reinterpret_cast<v8::internal::Isolate*>(isolate));
22437 reinterpret_cast<v8::internal::Isolate*>(isolate)); 22437 histogramTimer.Start();
22438 histogramTimer->Start();
22439 CHECK_EQ("V8.Test", last_event_message); 22438 CHECK_EQ("V8.Test", last_event_message);
22440 CHECK_EQ(0, last_event_status); 22439 CHECK_EQ(0, last_event_status);
22441 histogramTimer->Stop(); 22440 histogramTimer.Stop();
22442 CHECK_EQ("V8.Test", last_event_message); 22441 CHECK_EQ("V8.Test", last_event_message);
22443 CHECK_EQ(1, last_event_status); 22442 CHECK_EQ(1, last_event_status);
22444 } 22443 }
22445 22444
22446 22445
22447 TEST(Promises) { 22446 TEST(Promises) {
22448 LocalContext context; 22447 LocalContext context;
22449 v8::Isolate* isolate = context->GetIsolate(); 22448 v8::Isolate* isolate = context->GetIsolate();
22450 v8::HandleScope scope(isolate); 22449 v8::HandleScope scope(isolate);
22451 Handle<Object> global = context->Global(); 22450 Handle<Object> global = context->Global();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
22642 Local<Script> script = v8::ScriptCompiler::Compile( 22641 Local<Script> script = v8::ScriptCompiler::Compile(
22643 isolate, &script_source); 22642 isolate, &script_source);
22644 Local<Value> script_name = script->GetUnboundScript()->GetScriptName(); 22643 Local<Value> script_name = script->GetUnboundScript()->GetScriptName();
22645 CHECK(!script_name.IsEmpty()); 22644 CHECK(!script_name.IsEmpty());
22646 CHECK(script_name->IsString()); 22645 CHECK(script_name->IsString());
22647 String::Utf8Value utf8_name(script_name); 22646 String::Utf8Value utf8_name(script_name);
22648 CHECK_EQ(url, *utf8_name); 22647 CHECK_EQ(url, *utf8_name);
22649 int line_number = script->GetUnboundScript()->GetLineNumber(0); 22648 int line_number = script->GetUnboundScript()->GetLineNumber(0);
22650 CHECK_EQ(13, line_number); 22649 CHECK_EQ(13, line_number);
22651 } 22650 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698