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

Unified Diff: test/cctest/test-debug.cc

Issue 14947005: fix nosnapshot test failure in 14793004, do not deprecate function (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 4d2cb0485fceb957b3bacf52ddedd804b199e4ea..1afe8901fad1b69e1eaa6c600433a83ff9686688 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -136,12 +136,16 @@ class DebugLocalContext {
v8::Handle<v8::ObjectTemplate> global_template =
v8::Handle<v8::ObjectTemplate>(),
v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>())
- : context_(v8::Context::New(extensions, global_template, global_object)) {
+ : scope_(v8::Isolate::GetCurrent()),
+ context_(
+ v8::Context::New(v8::Isolate::GetCurrent(),
+ extensions,
+ global_template,
+ global_object)) {
context_->Enter();
}
inline ~DebugLocalContext() {
context_->Exit();
- context_.Dispose(context_->GetIsolate());
}
inline v8::Context* operator->() { return *context_; }
inline v8::Context* operator*() { return *context_; }
@@ -166,7 +170,8 @@ class DebugLocalContext {
}
private:
- v8::Persistent<v8::Context> context_;
+ v8::HandleScope scope_;
+ v8::Local<v8::Context> context_;
};
@@ -4234,7 +4239,8 @@ static const char* kSimpleExtensionSource =
// http://crbug.com/28933
// Test that debug break is disabled when bootstrapper is active.
TEST(NoBreakWhenBootstrapping) {
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
// Register a debug event listener which sets the break flag and counts.
v8::Debug::SetDebugEventListener(DebugEventCounter);
@@ -4249,8 +4255,8 @@ TEST(NoBreakWhenBootstrapping) {
kSimpleExtensionSource));
const char* extension_names[] = { "simpletest" };
v8::ExtensionConfiguration extensions(1, extension_names);
- v8::Persistent<v8::Context> context = v8::Context::New(&extensions);
- context.Dispose(context->GetIsolate());
+ v8::HandleScope handle_scope(isolate);
+ v8::Context::New(isolate, &extensions);
}
// Check that no DebugBreak events occured during the context creation.
CHECK_EQ(0, break_point_hit_count);
@@ -6235,7 +6241,7 @@ TEST(ScriptNameAndData) {
}
-static v8::Persistent<v8::Context> expected_context;
+static v8::Handle<v8::Context> expected_context;
static v8::Handle<v8::Value> expected_context_data;
@@ -6293,7 +6299,7 @@ TEST(ContextData) {
// Enter and run function in the first context.
{
v8::Context::Scope context_scope(context_1);
- expected_context = v8::Persistent<v8::Context>(*context_1);
+ expected_context = context_1;
expected_context_data = data_1;
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_1->Global(), 0, NULL);
@@ -6303,7 +6309,7 @@ TEST(ContextData) {
// Enter and run function in the second context.
{
v8::Context::Scope context_scope(context_2);
- expected_context = v8::Persistent<v8::Context>(*context_2);
+ expected_context = context_2;
expected_context_data = data_2;
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_2->Global(), 0, NULL);
@@ -6454,7 +6460,7 @@ static void ExecuteScriptForContextCheck() {
// Enter and run function in the context.
{
v8::Context::Scope context_scope(context_1);
- expected_context = v8::Persistent<v8::Context>(*context_1);
+ expected_context = v8::Local<v8::Context>(*context_1);
expected_context_data = data_1;
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_1->Global(), 0, NULL);
@@ -6615,22 +6621,26 @@ TEST(ScriptCollectedEventContext) {
script_collected_message_count = 0;
v8::HandleScope scope(isolate);
- { // Scope for the DebugLocalContext.
- DebugLocalContext env;
+ v8::Persistent<v8::Context> context;
+ {
+ v8::HandleScope scope(isolate);
+ context.Reset(isolate, v8::Context::New(isolate));
+ }
+ context->Enter();
- // Request the loaded scripts to initialize the debugger script cache.
- debug->GetLoadedScripts();
+ // Request the loaded scripts to initialize the debugger script cache.
+ debug->GetLoadedScripts();
- // Do garbage collection to ensure that only the script in this test will be
- // collected afterwards.
- HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ // Do garbage collection to ensure that only the script in this test will be
+ // collected afterwards.
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
- v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler);
- {
- v8::Script::Compile(v8::String::New("eval('a=1')"))->Run();
- v8::Script::Compile(v8::String::New("eval('a=2')"))->Run();
- }
- }
+ v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler);
+ v8::Script::Compile(v8::String::New("eval('a=1')"))->Run();
+ v8::Script::Compile(v8::String::New("eval('a=2')"))->Run();
+
+ context->Exit();
+ context.Dispose(isolate);
// Do garbage collection to collect the script above which is no longer
// referenced.
@@ -7089,15 +7099,14 @@ static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
// Check that event details contain context where debug event occured.
TEST(DebugEventContext) {
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
expected_callback_data = v8::Int32::New(2010);
v8::Debug::SetDebugEventListener2(DebugEventContextChecker,
expected_callback_data);
- expected_context = v8::Context::New();
- v8::Context::Scope context_scope(
- v8::Isolate::GetCurrent(), expected_context);
+ expected_context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(expected_context);
v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run();
- expected_context.Dispose(expected_context->GetIsolate());
expected_context.Clear();
v8::Debug::SetDebugEventListener(NULL);
expected_context_data = v8::Handle<v8::Value>();
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698