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

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

Issue 549057: Implement issue 554 Add "ProcessDebuggerRequests" call to Debug Agent API (Closed)
Patch Set: clean up Created 10 years, 11 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
« no previous file with comments | « src/execution.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
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index cad1ba3ae5122d9a6b3590ba56f45a92885db6a7..918c7eccc31b26412935a8b2bac50e51dffb9bfb 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -5655,6 +5655,51 @@ TEST(NoDebugBreakInAfterCompileMessageHandler) {
}
+static int counting_message_handler_counter;
+
+static void CountingMessageHandler(const v8::Debug::Message& message) {
+ counting_message_handler_counter++;
+}
+
+// Test that debug messages get processed when ProcessDebugMessages is called.
+TEST(ProcessDebugMessages) {
+ v8::HandleScope scope;
+ DebugLocalContext env;
+
+ counting_message_handler_counter = 0;
+
+ v8::Debug::SetMessageHandler2(CountingMessageHandler);
+
+ const int kBufferSize = 1000;
+ uint16_t buffer[kBufferSize];
+ const char* scripts_command =
+ "{\"seq\":0,"
+ "\"type\":\"request\","
+ "\"command\":\"scripts\"}";
+
+ // Send scripts command.
+ v8::Debug::SendCommand(buffer, AsciiToUtf16(scripts_command, buffer));
+
+ CHECK_EQ(0, counting_message_handler_counter);
+ v8::Debug::ProcessDebugMessages();
+ // At least one message should come
+ CHECK_GE(counting_message_handler_counter, 1);
+
+ counting_message_handler_counter = 0;
+
+ v8::Debug::SendCommand(buffer, AsciiToUtf16(scripts_command, buffer));
+ v8::Debug::SendCommand(buffer, AsciiToUtf16(scripts_command, buffer));
+ CHECK_EQ(0, counting_message_handler_counter);
+ v8::Debug::ProcessDebugMessages();
+ // At least two messages should come
+ CHECK_GE(counting_message_handler_counter, 2);
+
+ // Get rid of the debug message handler.
+ v8::Debug::SetMessageHandler2(NULL);
+ CheckDebuggerUnloaded();
+}
+
+
TEST(GetMirror) {
v8::HandleScope scope;
DebugLocalContext env;
« no previous file with comments | « src/execution.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698