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

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

Issue 50007: Better handling of startup and shutdown of the debugger agent (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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/debug-agent.cc ('k') | test/cctest/test-sockets.cc » ('j') | 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 1545)
+++ test/cctest/test-debug.cc (working copy)
@@ -3822,3 +3822,44 @@
// The host dispatch callback should be called.
CHECK_EQ(1, host_dispatch_hit_count);
}
+
+
+TEST(DebuggerAgent) {
+ // Make sure this port is not used by other tests to allow tests to run in
+ // parallel.
+ const int kPort = 5858;
+
+ // Make a string with the port number.
+ const int kPortBuferLen = 6;
+ char port_str[kPortBuferLen];
+ OS::SNPrintF(i::Vector<char>(port_str, kPortBuferLen), "%d", kPort);
+
+ bool ok;
+
+ // Initialize the socket library.
+ i::Socket::Setup();
+
+ // Test starting and stopping the agent without any client connection.
+ i::Debugger::StartAgent(kPort);
+ i::Debugger::StopAgent();
+
+ // Test starting the agent, connecting a client and shutting down the agent
+ // with the client connected.
+ ok = i::Debugger::StartAgent(kPort);
+ CHECK(ok);
+ i::Socket* client = i::OS::CreateSocket();
+ ok = client->Connect("localhost", port_str);
+ CHECK(ok);
+ i::Debugger::StopAgent();
+ delete client;
+
+ // Test starting and stopping the agent with the required port already
+ // occoupied.
+ i::Socket* server = i::OS::CreateSocket();
+ server->Bind(kPort);
+
+ i::Debugger::StartAgent(kPort);
+ i::Debugger::StopAgent();
+
+ delete server;
+}
« no previous file with comments | « src/debug-agent.cc ('k') | test/cctest/test-sockets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698