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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug-agent.cc ('k') | test/cctest/test-sockets.cc » ('j') | 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 3804 matching lines...) Expand 10 before | Expand all | Expand 10 after
3815 3815
3816 // Fill a host dispatch and a continue command on the command queue before 3816 // Fill a host dispatch and a continue command on the command queue before
3817 // running some code. 3817 // running some code.
3818 v8::Debug::SendHostDispatch(NULL); 3818 v8::Debug::SendHostDispatch(NULL);
3819 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_continue, buffer)); 3819 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_continue, buffer));
3820 CompileRun("void 0"); 3820 CompileRun("void 0");
3821 3821
3822 // The host dispatch callback should be called. 3822 // The host dispatch callback should be called.
3823 CHECK_EQ(1, host_dispatch_hit_count); 3823 CHECK_EQ(1, host_dispatch_hit_count);
3824 } 3824 }
3825
3826
3827 TEST(DebuggerAgent) {
3828 // Make sure this port is not used by other tests to allow tests to run in
3829 // parallel.
3830 const int kPort = 5858;
3831
3832 // Make a string with the port number.
3833 const int kPortBuferLen = 6;
3834 char port_str[kPortBuferLen];
3835 OS::SNPrintF(i::Vector<char>(port_str, kPortBuferLen), "%d", kPort);
3836
3837 bool ok;
3838
3839 // Initialize the socket library.
3840 i::Socket::Setup();
3841
3842 // Test starting and stopping the agent without any client connection.
3843 i::Debugger::StartAgent(kPort);
3844 i::Debugger::StopAgent();
3845
3846 // Test starting the agent, connecting a client and shutting down the agent
3847 // with the client connected.
3848 ok = i::Debugger::StartAgent(kPort);
3849 CHECK(ok);
3850 i::Socket* client = i::OS::CreateSocket();
3851 ok = client->Connect("localhost", port_str);
3852 CHECK(ok);
3853 i::Debugger::StopAgent();
3854 delete client;
3855
3856 // Test starting and stopping the agent with the required port already
3857 // occoupied.
3858 i::Socket* server = i::OS::CreateSocket();
3859 server->Bind(kPort);
3860
3861 i::Debugger::StartAgent(kPort);
3862 i::Debugger::StopAgent();
3863
3864 delete server;
3865 }
OLDNEW
« 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