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

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

Issue 67180: Add debug command break flag for debugger host dispatch (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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.cc ('k') | 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 4007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4018 v8::HandleScope scope; 4018 v8::HandleScope scope;
4019 DebugLocalContext env; 4019 DebugLocalContext env;
4020 4020
4021 const int kBufferSize = 1000; 4021 const int kBufferSize = 1000;
4022 uint16_t buffer[kBufferSize]; 4022 uint16_t buffer[kBufferSize];
4023 const char* command_continue = 4023 const char* command_continue =
4024 "{\"seq\":0," 4024 "{\"seq\":0,"
4025 "\"type\":\"request\"," 4025 "\"type\":\"request\","
4026 "\"command\":\"continue\"}"; 4026 "\"command\":\"continue\"}";
4027 4027
4028 // Create an empty function to call for processing debug commands
4029 v8::Local<v8::Function> empty =
4030 CompileFunction(&env, "function empty(){}", "empty");
4031
4028 // Setup message and host dispatch handlers. 4032 // Setup message and host dispatch handlers.
4029 v8::Debug::SetMessageHandler(DummyMessageHandler); 4033 v8::Debug::SetMessageHandler(DummyMessageHandler);
4030 v8::Debug::SetHostDispatchHandler(HostDispatchHandlerHitCount, 4034 v8::Debug::SetHostDispatchHandler(HostDispatchHandlerHitCount,
4031 NULL); 4035 NULL);
4032 4036
4033 // Fill a host dispatch and a continue command on the command queue before 4037 // Send a host dispatch by itself.
4034 // running some code. 4038 v8::Debug::SendHostDispatch(NULL);
4039 empty->Call(env->Global(), 0, NULL); // Run JavaScript to activate debugger.
4040 CHECK_EQ(1, host_dispatch_hit_count);
4041
4042 // Fill a host dispatch and a continue command on the command queue.
4035 v8::Debug::SendHostDispatch(NULL); 4043 v8::Debug::SendHostDispatch(NULL);
4036 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_continue, buffer)); 4044 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_continue, buffer));
4037 CompileRun("void 0"); 4045 empty->Call(env->Global(), 0, NULL); // Run JavaScript to activate debugger.
4038 4046
4039 // The host dispatch callback should be called. 4047 // Fill a continue command and a host dispatch on the command queue.
4040 CHECK_EQ(1, host_dispatch_hit_count); 4048 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_continue, buffer));
4049 v8::Debug::SendHostDispatch(NULL);
4050 empty->Call(env->Global(), 0, NULL); // Run JavaScript to activate debugger.
4051 empty->Call(env->Global(), 0, NULL); // Run JavaScript to activate debugger.
4052
4053 // All the host dispatch callback should be called.
4054 CHECK_EQ(3, host_dispatch_hit_count);
4041 } 4055 }
4042 4056
4043 4057
4044 TEST(DebuggerAgent) { 4058 TEST(DebuggerAgent) {
4045 // Make sure this port is not used by other tests to allow tests to run in 4059 // Make sure this port is not used by other tests to allow tests to run in
4046 // parallel. 4060 // parallel.
4047 const int kPort = 5858; 4061 const int kPort = 5858;
4048 4062
4049 // Make a string with the port number. 4063 // Make a string with the port number.
4050 const int kPortBufferLen = 6; 4064 const int kPortBufferLen = 6;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4228 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; 4242 bool allow_natives_syntax = i::FLAG_allow_natives_syntax;
4229 i::FLAG_allow_natives_syntax = true; 4243 i::FLAG_allow_natives_syntax = true;
4230 CompileRun( 4244 CompileRun(
4231 "var scripts = %DebugGetLoadedScripts();" 4245 "var scripts = %DebugGetLoadedScripts();"
4232 "for (var i = 0; i < scripts.length; ++i) {" 4246 "for (var i = 0; i < scripts.length; ++i) {"
4233 " scripts[i].line_ends;" 4247 " scripts[i].line_ends;"
4234 "}"); 4248 "}");
4235 // Must not crash while accessing line_ends. 4249 // Must not crash while accessing line_ends.
4236 i::FLAG_allow_natives_syntax = allow_natives_syntax; 4250 i::FLAG_allow_natives_syntax = allow_natives_syntax;
4237 } 4251 }
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698