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

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

Issue 6903172: Use JSON.parse instead of eval for the debugger JSON protocol. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 9 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/debug-debugger.js ('k') | test/mjsunit/debug-evaluate.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 6294 matching lines...) Expand 10 before | Expand all | Expand 10 after
6306 } 6306 }
6307 #endif // V8_INTERPRETED_REGEXP 6307 #endif // V8_INTERPRETED_REGEXP
6308 6308
6309 6309
6310 // Common part of EvalContextData and NestedBreakEventContextData tests. 6310 // Common part of EvalContextData and NestedBreakEventContextData tests.
6311 static void ExecuteScriptForContextCheck() { 6311 static void ExecuteScriptForContextCheck() {
6312 // Create a context. 6312 // Create a context.
6313 v8::Persistent<v8::Context> context_1; 6313 v8::Persistent<v8::Context> context_1;
6314 v8::Handle<v8::ObjectTemplate> global_template = 6314 v8::Handle<v8::ObjectTemplate> global_template =
6315 v8::Handle<v8::ObjectTemplate>(); 6315 v8::Handle<v8::ObjectTemplate>();
6316 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); 6316 context_1 = v8::Context::New(NULL, global_template);
6317 context_1 = v8::Context::New(NULL, global_template, global_object);
6318 6317
6319 // Default data value is undefined. 6318 // Default data value is undefined.
6320 CHECK(context_1->GetData()->IsUndefined()); 6319 CHECK(context_1->GetData()->IsUndefined());
6321 6320
6322 // Set and check a data value. 6321 // Set and check a data value.
6323 v8::Handle<v8::String> data_1 = v8::String::New("1"); 6322 v8::Handle<v8::String> data_1 = v8::String::New("1");
6324 context_1->SetData(data_1); 6323 context_1->SetData(data_1);
6325 CHECK(context_1->GetData()->StrictEquals(data_1)); 6324 CHECK(context_1->GetData()->StrictEquals(data_1));
6326 6325
6327 // Simple test function with eval that causes a break. 6326 // Simple test function with eval that causes a break.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
6372 Utf16ToAscii(*json, json.length(), print_buffer); 6371 Utf16ToAscii(*json, json.length(), print_buffer);
6373 6372
6374 if (IsBreakEventMessage(print_buffer)) { 6373 if (IsBreakEventMessage(print_buffer)) {
6375 break_count++; 6374 break_count++;
6376 if (!sent_eval) { 6375 if (!sent_eval) {
6377 sent_eval = true; 6376 sent_eval = true;
6378 6377
6379 const int kBufferSize = 1000; 6378 const int kBufferSize = 1000;
6380 uint16_t buffer[kBufferSize]; 6379 uint16_t buffer[kBufferSize];
6381 const char* eval_command = 6380 const char* eval_command =
6382 "{\"seq\":0," 6381 "{\"seq\":0,"
6383 "\"type\":\"request\"," 6382 "\"type\":\"request\","
6384 "\"command\":\"evaluate\"," 6383 "\"command\":\"evaluate\","
6385 "arguments:{\"expression\":\"debugger;\"," 6384 "\"arguments\":{\"expression\":\"debugger;\","
6386 "\"global\":true,\"disable_break\":false}}"; 6385 "\"global\":true,\"disable_break\":false}}";
6387 6386
6388 // Send evaluate command. 6387 // Send evaluate command.
6389 v8::Debug::SendCommand(buffer, AsciiToUtf16(eval_command, buffer)); 6388 v8::Debug::SendCommand(buffer, AsciiToUtf16(eval_command, buffer));
6390 return; 6389 return;
6391 } else { 6390 } else {
6392 // It's a break event caused by the evaluation request above. 6391 // It's a break event caused by the evaluation request above.
6393 SendContinueCommand(); 6392 SendContinueCommand();
6394 continue_command_send_count++; 6393 continue_command_send_count++;
6395 } 6394 }
6396 } else if (IsEvaluateResponseMessage(print_buffer) && 6395 } else if (IsEvaluateResponseMessage(print_buffer) &&
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
7261 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); 7260 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}");
7262 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); 7261 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}");
7263 7262
7264 // Get rid of the debug event listener. 7263 // Get rid of the debug event listener.
7265 v8::Debug::SetDebugEventListener(NULL); 7264 v8::Debug::SetDebugEventListener(NULL);
7266 CheckDebuggerUnloaded(); 7265 CheckDebuggerUnloaded();
7267 } 7266 }
7268 7267
7269 7268
7270 #endif // ENABLE_DEBUGGER_SUPPORT 7269 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/debug-debugger.js ('k') | test/mjsunit/debug-evaluate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698