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

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

Issue 1181013007: Debugger: require debugger to be active when dealing with breaks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix yet another test Created 5 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 unified diff | Download patch
« no previous file with comments | « test/cctest/cctest.h ('k') | test/cctest/test-debug.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 20942 matching lines...) Expand 10 before | Expand all | Expand 10 after
20953 NULL}; 20953 NULL};
20954 20954
20955 LocalContext env; 20955 LocalContext env;
20956 v8::Isolate* isolate = env->GetIsolate(); 20956 v8::Isolate* isolate = env->GetIsolate();
20957 v8::HandleScope scope(isolate); 20957 v8::HandleScope scope(isolate);
20958 20958
20959 // Make the debugger active by setting a breakpoint. 20959 // Make the debugger active by setting a breakpoint.
20960 CompileRun("function break_here() { }"); 20960 CompileRun("function break_here() { }");
20961 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( 20961 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(
20962 v8::Utils::OpenHandle(*env->Global()->Get(v8_str("break_here")))); 20962 v8::Utils::OpenHandle(*env->Global()->Get(v8_str("break_here"))));
20963 EnableDebugger();
20963 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); 20964 v8::internal::Debug* debug = CcTest::i_isolate()->debug();
20964 int position = 0; 20965 int position = 0;
20965 debug->SetBreakPoint(func, i::Handle<i::Object>(v8::internal::Smi::FromInt(1), 20966 debug->SetBreakPoint(func, i::Handle<i::Object>(v8::internal::Smi::FromInt(1),
20966 CcTest::i_isolate()), 20967 CcTest::i_isolate()),
20967 &position); 20968 &position);
20968 20969
20969 v8::ScriptCompiler::StreamedSource source( 20970 v8::ScriptCompiler::StreamedSource source(
20970 new TestSourceStream(chunks), 20971 new TestSourceStream(chunks),
20971 v8::ScriptCompiler::StreamedSource::ONE_BYTE); 20972 v8::ScriptCompiler::StreamedSource::ONE_BYTE);
20972 v8::ScriptCompiler::ScriptStreamingTask* task = 20973 v8::ScriptCompiler::ScriptStreamingTask* task =
20973 v8::ScriptCompiler::StartStreamingScript( 20974 v8::ScriptCompiler::StartStreamingScript(
20974 isolate, &source, v8::ScriptCompiler::kProduceParserCache); 20975 isolate, &source, v8::ScriptCompiler::kProduceParserCache);
20975 20976
20976 // TestSourceStream::GetMoreData won't block, so it's OK to just run the 20977 // TestSourceStream::GetMoreData won't block, so it's OK to just run the
20977 // task here in the main thread. 20978 // task here in the main thread.
20978 task->Run(); 20979 task->Run();
20979 delete task; 20980 delete task;
20980 20981
20981 // Check that we got no cached data. 20982 // Check that we got no cached data.
20982 CHECK(source.GetCachedData() == NULL); 20983 CHECK(source.GetCachedData() == NULL);
20984 DisableDebugger();
20983 } 20985 }
20984 20986
20985 20987
20986 TEST(StreamingScriptWithInvalidUtf8) { 20988 TEST(StreamingScriptWithInvalidUtf8) {
20987 // Regression test for a crash: test that invalid UTF-8 bytes in the end of a 20989 // Regression test for a crash: test that invalid UTF-8 bytes in the end of a
20988 // chunk don't produce a crash. 20990 // chunk don't produce a crash.
20989 const char* reference = "\xec\x92\x81\x80\x80"; 20991 const char* reference = "\xec\x92\x81\x80\x80";
20990 char chunk1[] = 20992 char chunk1[] =
20991 "function foo() {\n" 20993 "function foo() {\n"
20992 " // This function will contain an UTF-8 character which is not in\n" 20994 " // This function will contain an UTF-8 character which is not in\n"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
21605 CHECK_EQ(2U, set->Size()); 21607 CHECK_EQ(2U, set->Size());
21606 21608
21607 v8::Local<v8::Array> keys = set->AsArray(); 21609 v8::Local<v8::Array> keys = set->AsArray();
21608 CHECK_EQ(2U, keys->Length()); 21610 CHECK_EQ(2U, keys->Length());
21609 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); 21611 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value());
21610 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); 21612 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value());
21611 21613
21612 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); 21614 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked();
21613 CHECK_EQ(2U, set->Size()); 21615 CHECK_EQ(2U, set->Size());
21614 } 21616 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698