OLD | NEW |
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 3822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3833 const int kPortBuferLen = 6; | 3833 const int kPortBuferLen = 6; |
3834 char port_str[kPortBuferLen]; | 3834 char port_str[kPortBuferLen]; |
3835 OS::SNPrintF(i::Vector<char>(port_str, kPortBuferLen), "%d", kPort); | 3835 OS::SNPrintF(i::Vector<char>(port_str, kPortBuferLen), "%d", kPort); |
3836 | 3836 |
3837 bool ok; | 3837 bool ok; |
3838 | 3838 |
3839 // Initialize the socket library. | 3839 // Initialize the socket library. |
3840 i::Socket::Setup(); | 3840 i::Socket::Setup(); |
3841 | 3841 |
3842 // Test starting and stopping the agent without any client connection. | 3842 // Test starting and stopping the agent without any client connection. |
3843 i::Debugger::StartAgent(kPort); | 3843 i::Debugger::StartAgent("test", kPort); |
3844 i::Debugger::StopAgent(); | 3844 i::Debugger::StopAgent(); |
3845 | 3845 |
3846 // Test starting the agent, connecting a client and shutting down the agent | 3846 // Test starting the agent, connecting a client and shutting down the agent |
3847 // with the client connected. | 3847 // with the client connected. |
3848 ok = i::Debugger::StartAgent(kPort); | 3848 ok = i::Debugger::StartAgent("test", kPort); |
3849 CHECK(ok); | 3849 CHECK(ok); |
3850 i::Socket* client = i::OS::CreateSocket(); | 3850 i::Socket* client = i::OS::CreateSocket(); |
3851 ok = client->Connect("localhost", port_str); | 3851 ok = client->Connect("localhost", port_str); |
3852 CHECK(ok); | 3852 CHECK(ok); |
3853 i::Debugger::StopAgent(); | 3853 i::Debugger::StopAgent(); |
3854 delete client; | 3854 delete client; |
3855 | 3855 |
3856 // Test starting and stopping the agent with the required port already | 3856 // Test starting and stopping the agent with the required port already |
3857 // occoupied. | 3857 // occoupied. |
3858 i::Socket* server = i::OS::CreateSocket(); | 3858 i::Socket* server = i::OS::CreateSocket(); |
3859 server->Bind(kPort); | 3859 server->Bind(kPort); |
3860 | 3860 |
3861 i::Debugger::StartAgent(kPort); | 3861 i::Debugger::StartAgent("test", kPort); |
3862 i::Debugger::StopAgent(); | 3862 i::Debugger::StopAgent(); |
3863 | 3863 |
3864 delete server; | 3864 delete server; |
3865 } | 3865 } |
OLD | NEW |