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

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

Issue 650047: Typo fixed. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 5940 matching lines...) Expand 10 before | Expand all | Expand 10 after
5951 v8::Debug::ProcessDebugMessages(); 5951 v8::Debug::ProcessDebugMessages();
5952 // At least two messages should come 5952 // At least two messages should come
5953 CHECK_GE(counting_message_handler_counter, 2); 5953 CHECK_GE(counting_message_handler_counter, 2);
5954 5954
5955 // Get rid of the debug message handler. 5955 // Get rid of the debug message handler.
5956 v8::Debug::SetMessageHandler2(NULL); 5956 v8::Debug::SetMessageHandler2(NULL);
5957 CheckDebuggerUnloaded(); 5957 CheckDebuggerUnloaded();
5958 } 5958 }
5959 5959
5960 5960
5961 struct BracktraceData { 5961 struct BacktraceData {
5962 static int frame_counter; 5962 static int frame_counter;
5963 static void MessageHandler(const v8::Debug::Message& message) { 5963 static void MessageHandler(const v8::Debug::Message& message) {
5964 char print_buffer[1000]; 5964 char print_buffer[1000];
5965 v8::String::Value json(message.GetJSON()); 5965 v8::String::Value json(message.GetJSON());
5966 Utf16ToAscii(*json, json.length(), print_buffer, 1000); 5966 Utf16ToAscii(*json, json.length(), print_buffer, 1000);
5967 5967
5968 if (strstr(print_buffer, "backtrace") == NULL) { 5968 if (strstr(print_buffer, "backtrace") == NULL) {
5969 return; 5969 return;
5970 } 5970 }
5971 frame_counter = GetTotalFramesInt(print_buffer); 5971 frame_counter = GetTotalFramesInt(print_buffer);
5972 } 5972 }
5973 }; 5973 };
5974 5974
5975 int BracktraceData::frame_counter; 5975 int BacktraceData::frame_counter;
5976 5976
5977 5977
5978 // Test that debug messages get processed when ProcessDebugMessages is called. 5978 // Test that debug messages get processed when ProcessDebugMessages is called.
5979 TEST(Backtrace) { 5979 TEST(Backtrace) {
5980 v8::HandleScope scope; 5980 v8::HandleScope scope;
5981 DebugLocalContext env; 5981 DebugLocalContext env;
5982 5982
5983 v8::Debug::SetMessageHandler2(BracktraceData::MessageHandler); 5983 v8::Debug::SetMessageHandler2(BacktraceData::MessageHandler);
5984 5984
5985 const int kBufferSize = 1000; 5985 const int kBufferSize = 1000;
5986 uint16_t buffer[kBufferSize]; 5986 uint16_t buffer[kBufferSize];
5987 const char* scripts_command = 5987 const char* scripts_command =
5988 "{\"seq\":0," 5988 "{\"seq\":0,"
5989 "\"type\":\"request\"," 5989 "\"type\":\"request\","
5990 "\"command\":\"backtrace\"}"; 5990 "\"command\":\"backtrace\"}";
5991 5991
5992 // Check backtrace from ProcessDebugMessages. 5992 // Check backtrace from ProcessDebugMessages.
5993 BracktraceData::frame_counter = -10; 5993 BacktraceData::frame_counter = -10;
5994 v8::Debug::SendCommand(buffer, AsciiToUtf16(scripts_command, buffer)); 5994 v8::Debug::SendCommand(buffer, AsciiToUtf16(scripts_command, buffer));
5995 v8::Debug::ProcessDebugMessages(); 5995 v8::Debug::ProcessDebugMessages();
5996 CHECK_EQ(BracktraceData::frame_counter, 0); 5996 CHECK_EQ(BacktraceData::frame_counter, 0);
5997 5997
5998 v8::Handle<v8::String> void0 = v8::String::New("void(0)"); 5998 v8::Handle<v8::String> void0 = v8::String::New("void(0)");
5999 v8::Handle<v8::Script> script = v8::Script::Compile(void0, void0); 5999 v8::Handle<v8::Script> script = v8::Script::Compile(void0, void0);
6000 6000
6001 // Check backtrace from "void(0)" script. 6001 // Check backtrace from "void(0)" script.
6002 BracktraceData::frame_counter = -10; 6002 BacktraceData::frame_counter = -10;
6003 v8::Debug::SendCommand(buffer, AsciiToUtf16(scripts_command, buffer)); 6003 v8::Debug::SendCommand(buffer, AsciiToUtf16(scripts_command, buffer));
6004 script->Run(); 6004 script->Run();
6005 CHECK_EQ(BracktraceData::frame_counter, 1); 6005 CHECK_EQ(BacktraceData::frame_counter, 1);
6006 6006
6007 // Get rid of the debug message handler. 6007 // Get rid of the debug message handler.
6008 v8::Debug::SetMessageHandler2(NULL); 6008 v8::Debug::SetMessageHandler2(NULL);
6009 CheckDebuggerUnloaded(); 6009 CheckDebuggerUnloaded();
6010 } 6010 }
6011 6011
6012 6012
6013 TEST(GetMirror) { 6013 TEST(GetMirror) {
6014 v8::HandleScope scope; 6014 v8::HandleScope scope;
6015 DebugLocalContext env; 6015 DebugLocalContext env;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
6134 6134
6135 break_point_hit_count = 0; 6135 break_point_hit_count = 0;
6136 foo->Call(env->Global(), 0, NULL); 6136 foo->Call(env->Global(), 0, NULL);
6137 CHECK_EQ(1, break_point_hit_count); 6137 CHECK_EQ(1, break_point_hit_count);
6138 6138
6139 v8::Debug::SetDebugEventListener(NULL); 6139 v8::Debug::SetDebugEventListener(NULL);
6140 debugee_context = v8::Handle<v8::Context>(); 6140 debugee_context = v8::Handle<v8::Context>();
6141 debugger_context = v8::Handle<v8::Context>(); 6141 debugger_context = v8::Handle<v8::Context>();
6142 CheckDebuggerUnloaded(); 6142 CheckDebuggerUnloaded();
6143 } 6143 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698