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

Unified Diff: test/cctest/test-debug.cc

Issue 20491: Add host callback for debug break.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« src/debug.cc ('K') | « src/debug.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
===================================================================
--- test/cctest/test-debug.cc (revision 1312)
+++ test/cctest/test-debug.cc (working copy)
@@ -3660,3 +3660,40 @@
v8::Debug::SetDebugEventListener(NULL);
CheckDebuggerUnloaded(true);
}
+
+
+int host_dispatch_hit_count = 0;
+static void HostDispatchHandlerHitCount(void* dispatch, void *data) {
+ CHECK_EQ(dispatch, &HostDispatchHandlerHitCount);
+ CHECK_EQ(data, &HostDispatchHandlerHitCount);
+ host_dispatch_hit_count++;
+}
+
+
+// Test that clearing the debug event listener actually clears all break points
+// and related information.
+TEST(DebuggerHostDispatch) {
+ v8::HandleScope scope;
+ DebugLocalContext env;
+
+ const int kBufferSize = 1000;
+ uint16_t buffer[kBufferSize];
+ const char* command_continue =
+ "{\"seq\":106,"
+ "\"type\":\"request\","
+ "\"command\":\"continue\"}";
+
+ // Setup message and host dispatch handlers.
+ v8::Debug::SetMessageHandler(DummyMessageHandler);
+ v8::Debug::SetHostDispatchHandler(HostDispatchHandlerHitCount,
+ &HostDispatchHandlerHitCount);
+
+ // Fill a host dispatch and a continue command on the command queue before
+ // generating a debug break.
+ v8::Debug::SendHostDispatch(&HostDispatchHandlerHitCount);
+ v8::Debug::SendCommand(buffer, AsciiToUtf16(command_continue, buffer));
+ CompileRun("debugger");
+
+ // The host dispatch callback should be called.
+ CHECK_EQ(1, host_dispatch_hit_count);
+}
« src/debug.cc ('K') | « src/debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698