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

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

Issue 15012016: small misspelling fixes. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/arguments-load-across-eval.js » ('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 4230 matching lines...) Expand 10 before | Expand all | Expand 10 after
4241 { 4241 {
4242 // Create a context with an extension to make sure that some JavaScript 4242 // Create a context with an extension to make sure that some JavaScript
4243 // code is executed during bootstrapping. 4243 // code is executed during bootstrapping.
4244 v8::RegisterExtension(new v8::Extension("simpletest", 4244 v8::RegisterExtension(new v8::Extension("simpletest",
4245 kSimpleExtensionSource)); 4245 kSimpleExtensionSource));
4246 const char* extension_names[] = { "simpletest" }; 4246 const char* extension_names[] = { "simpletest" };
4247 v8::ExtensionConfiguration extensions(1, extension_names); 4247 v8::ExtensionConfiguration extensions(1, extension_names);
4248 v8::Persistent<v8::Context> context = v8::Context::New(&extensions); 4248 v8::Persistent<v8::Context> context = v8::Context::New(&extensions);
4249 context.Dispose(context->GetIsolate()); 4249 context.Dispose(context->GetIsolate());
4250 } 4250 }
4251 // Check that no DebugBreak events occured during the context creation. 4251 // Check that no DebugBreak events occurred during the context creation.
4252 CHECK_EQ(0, break_point_hit_count); 4252 CHECK_EQ(0, break_point_hit_count);
4253 4253
4254 // Get rid of the debug event listener. 4254 // Get rid of the debug event listener.
4255 v8::Debug::SetDebugEventListener(NULL); 4255 v8::Debug::SetDebugEventListener(NULL);
4256 CheckDebuggerUnloaded(); 4256 CheckDebuggerUnloaded();
4257 } 4257 }
4258 4258
4259 static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) { 4259 static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) {
4260 v8::Handle<v8::Array> result = v8::Array::New(3); 4260 v8::Handle<v8::Array> result = v8::Array::New(3);
4261 result->Set(v8::Integer::New(0), v8::String::New("a")); 4261 result->Set(v8::Integer::New(0), v8::String::New("a"));
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
4758 // We match parts of the message to decide if it is a exception message. 4758 // We match parts of the message to decide if it is a exception message.
4759 bool IsExceptionEventMessage(char *message) { 4759 bool IsExceptionEventMessage(char *message) {
4760 const char* type_event = "\"type\":\"event\""; 4760 const char* type_event = "\"type\":\"event\"";
4761 const char* event_exception = "\"event\":\"exception\""; 4761 const char* event_exception = "\"event\":\"exception\"";
4762 // Does the message contain both type:event and event:exception? 4762 // Does the message contain both type:event and event:exception?
4763 return strstr(message, type_event) != NULL && 4763 return strstr(message, type_event) != NULL &&
4764 strstr(message, event_exception) != NULL; 4764 strstr(message, event_exception) != NULL;
4765 } 4765 }
4766 4766
4767 4767
4768 // We match the message wether it is an evaluate response message. 4768 // We match the message whether it is an evaluate response message.
4769 bool IsEvaluateResponseMessage(char* message) { 4769 bool IsEvaluateResponseMessage(char* message) {
4770 const char* type_response = "\"type\":\"response\""; 4770 const char* type_response = "\"type\":\"response\"";
4771 const char* command_evaluate = "\"command\":\"evaluate\""; 4771 const char* command_evaluate = "\"command\":\"evaluate\"";
4772 // Does the message contain both type:response and command:evaluate? 4772 // Does the message contain both type:response and command:evaluate?
4773 return strstr(message, type_response) != NULL && 4773 return strstr(message, type_response) != NULL &&
4774 strstr(message, command_evaluate) != NULL; 4774 strstr(message, command_evaluate) != NULL;
4775 } 4775 }
4776 4776
4777 4777
4778 static int StringToInt(const char* s) { 4778 static int StringToInt(const char* s) {
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
6391 TEST(RegExpDebugBreak) { 6391 TEST(RegExpDebugBreak) {
6392 // This test only applies to native regexps. 6392 // This test only applies to native regexps.
6393 DebugLocalContext env; 6393 DebugLocalContext env;
6394 v8::HandleScope scope(env->GetIsolate()); 6394 v8::HandleScope scope(env->GetIsolate());
6395 6395
6396 // Create a function for checking the function when hitting a break point. 6396 // Create a function for checking the function when hitting a break point.
6397 frame_function_name = CompileFunction(&env, 6397 frame_function_name = CompileFunction(&env,
6398 frame_function_name_source, 6398 frame_function_name_source,
6399 "frame_function_name"); 6399 "frame_function_name");
6400 6400
6401 // Test RegExp which matches white spaces and comments at the begining of a 6401 // Test RegExp which matches white spaces and comments at the beginning of a
6402 // source line. 6402 // source line.
6403 const char* script = 6403 const char* script =
6404 "var sourceLineBeginningSkip = /^(?:[ \\v\\h]*(?:\\/\\*.*?\\*\\/)*)*/;\n" 6404 "var sourceLineBeginningSkip = /^(?:[ \\v\\h]*(?:\\/\\*.*?\\*\\/)*)*/;\n"
6405 "function f(s) { return s.match(sourceLineBeginningSkip)[0].length; }"; 6405 "function f(s) { return s.match(sourceLineBeginningSkip)[0].length; }";
6406 6406
6407 v8::Local<v8::Function> f = CompileFunction(script, "f"); 6407 v8::Local<v8::Function> f = CompileFunction(script, "f");
6408 const int argc = 1; 6408 const int argc = 1;
6409 v8::Handle<v8::Value> argv[argc] = { v8::String::New(" /* xxx */ a=0;") }; 6409 v8::Handle<v8::Value> argv[argc] = { v8::String::New(" /* xxx */ a=0;") };
6410 v8::Local<v8::Value> result = f->Call(env->Global(), argc, argv); 6410 v8::Local<v8::Value> result = f->Call(env->Global(), argc, argv);
6411 CHECK_EQ(12, result->Int32Value()); 6411 CHECK_EQ(12, result->Int32Value());
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
7070 CHECK_EQ(*context1, *context2); 7070 CHECK_EQ(*context1, *context2);
7071 } 7071 }
7072 7072
7073 7073
7074 static v8::Handle<v8::Value> expected_callback_data; 7074 static v8::Handle<v8::Value> expected_callback_data;
7075 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { 7075 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
7076 CHECK(details.GetEventContext() == expected_context); 7076 CHECK(details.GetEventContext() == expected_context);
7077 CHECK_EQ(expected_callback_data, details.GetCallbackData()); 7077 CHECK_EQ(expected_callback_data, details.GetCallbackData());
7078 } 7078 }
7079 7079
7080 // Check that event details contain context where debug event occured. 7080 // Check that event details contain context where debug event occurred.
7081 TEST(DebugEventContext) { 7081 TEST(DebugEventContext) {
7082 v8::HandleScope scope(v8::Isolate::GetCurrent()); 7082 v8::HandleScope scope(v8::Isolate::GetCurrent());
7083 expected_callback_data = v8::Int32::New(2010); 7083 expected_callback_data = v8::Int32::New(2010);
7084 v8::Debug::SetDebugEventListener2(DebugEventContextChecker, 7084 v8::Debug::SetDebugEventListener2(DebugEventContextChecker,
7085 expected_callback_data); 7085 expected_callback_data);
7086 expected_context = v8::Context::New(); 7086 expected_context = v8::Context::New();
7087 v8::Context::Scope context_scope(expected_context); 7087 v8::Context::Scope context_scope(expected_context);
7088 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); 7088 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run();
7089 expected_context.Dispose(expected_context->GetIsolate()); 7089 expected_context.Dispose(expected_context->GetIsolate());
7090 expected_context.Clear(); 7090 expected_context.Clear();
7091 v8::Debug::SetDebugEventListener(NULL); 7091 v8::Debug::SetDebugEventListener(NULL);
7092 expected_context_data = v8::Handle<v8::Value>(); 7092 expected_context_data = v8::Handle<v8::Value>();
7093 CheckDebuggerUnloaded(); 7093 CheckDebuggerUnloaded();
7094 } 7094 }
7095 7095
7096 7096
7097 static void* expected_break_data; 7097 static void* expected_break_data;
7098 static bool was_debug_break_called; 7098 static bool was_debug_break_called;
7099 static bool was_debug_event_called; 7099 static bool was_debug_event_called;
7100 static void DebugEventBreakDataChecker(const v8::Debug::EventDetails& details) { 7100 static void DebugEventBreakDataChecker(const v8::Debug::EventDetails& details) {
7101 if (details.GetEvent() == v8::BreakForCommand) { 7101 if (details.GetEvent() == v8::BreakForCommand) {
7102 CHECK_EQ(expected_break_data, details.GetClientData()); 7102 CHECK_EQ(expected_break_data, details.GetClientData());
7103 was_debug_event_called = true; 7103 was_debug_event_called = true;
7104 } else if (details.GetEvent() == v8::Break) { 7104 } else if (details.GetEvent() == v8::Break) {
7105 was_debug_break_called = true; 7105 was_debug_break_called = true;
7106 } 7106 }
7107 } 7107 }
7108 7108
7109 7109
7110 // Check that event details contain context where debug event occured. 7110 // Check that event details contain context where debug event occurred.
7111 TEST(DebugEventBreakData) { 7111 TEST(DebugEventBreakData) {
7112 DebugLocalContext env; 7112 DebugLocalContext env;
7113 v8::HandleScope scope(env->GetIsolate()); 7113 v8::HandleScope scope(env->GetIsolate());
7114 v8::Debug::SetDebugEventListener2(DebugEventBreakDataChecker); 7114 v8::Debug::SetDebugEventListener2(DebugEventBreakDataChecker);
7115 7115
7116 TestClientData::constructor_call_counter = 0; 7116 TestClientData::constructor_call_counter = 0;
7117 TestClientData::destructor_call_counter = 0; 7117 TestClientData::destructor_call_counter = 0;
7118 7118
7119 expected_break_data = NULL; 7119 expected_break_data = NULL;
7120 was_debug_event_called = false; 7120 was_debug_event_called = false;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
7540 TEST(LiveEditDisabled) { 7540 TEST(LiveEditDisabled) {
7541 v8::internal::FLAG_allow_natives_syntax = true; 7541 v8::internal::FLAG_allow_natives_syntax = true;
7542 LocalContext env; 7542 LocalContext env;
7543 v8::HandleScope scope(env->GetIsolate()); 7543 v8::HandleScope scope(env->GetIsolate());
7544 v8::Debug::SetLiveEditEnabled(false); 7544 v8::Debug::SetLiveEditEnabled(false);
7545 CompileRun("%LiveEditCompareStrings('', '')"); 7545 CompileRun("%LiveEditCompareStrings('', '')");
7546 } 7546 }
7547 7547
7548 7548
7549 #endif // ENABLE_DEBUGGER_SUPPORT 7549 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/arguments-load-across-eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698