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

Side by Side Diff: test/cctest/test-debug.cc

Issue 8038046: Fixing test case from r9469. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 9 years, 2 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 | « no previous file | test/cctest/test-threads.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5827 matching lines...) Expand 10 before | Expand all | Expand 10 after
5838 5838
5839 5839
5840 TEST(DebuggerAgent) { 5840 TEST(DebuggerAgent) {
5841 v8::V8::Initialize(); 5841 v8::V8::Initialize();
5842 i::Debugger* debugger = i::Isolate::Current()->debugger(); 5842 i::Debugger* debugger = i::Isolate::Current()->debugger();
5843 // Make sure these ports is not used by other tests to allow tests to run in 5843 // Make sure these ports is not used by other tests to allow tests to run in
5844 // parallel. 5844 // parallel.
5845 const int kPort1 = 5858; 5845 const int kPort1 = 5858;
5846 const int kPort2 = 5857; 5846 const int kPort2 = 5857;
5847 const int kPort3 = 5856; 5847 const int kPort3 = 5856;
5848 const int kPort4 = 5855;
5849 5848
5850 // Make a string with the port2 number. 5849 // Make a string with the port2 number.
5851 const int kPortBufferLen = 6; 5850 const int kPortBufferLen = 6;
5852 char port2_str[kPortBufferLen]; 5851 char port2_str[kPortBufferLen];
5853 OS::SNPrintF(i::Vector<char>(port2_str, kPortBufferLen), "%d", kPort2); 5852 OS::SNPrintF(i::Vector<char>(port2_str, kPortBufferLen), "%d", kPort2);
5854 char port4_str[kPortBufferLen];
5855 OS::SNPrintF(i::Vector<char>(port4_str, kPortBufferLen), "%d", kPort4);
5856 5853
5857 bool ok; 5854 bool ok;
5858 5855
5859 // Initialize the socket library. 5856 // Initialize the socket library.
5860 i::Socket::Setup(); 5857 i::Socket::Setup();
5861 5858
5862 // Test starting and stopping the agent without any client connection. 5859 // Test starting and stopping the agent without any client connection.
5863 debugger->StartAgent("test", kPort1); 5860 debugger->StartAgent("test", kPort1);
5864 debugger->StopAgent(); 5861 debugger->StopAgent();
5865 // Test starting the agent, connecting a client and shutting down the agent 5862 // Test starting the agent, connecting a client and shutting down the agent
(...skipping 15 matching lines...) Expand all
5881 5878
5882 // Test starting and stopping the agent with the required port already 5879 // Test starting and stopping the agent with the required port already
5883 // occoupied. 5880 // occoupied.
5884 i::Socket* server = i::OS::CreateSocket(); 5881 i::Socket* server = i::OS::CreateSocket();
5885 server->Bind(kPort3); 5882 server->Bind(kPort3);
5886 5883
5887 debugger->StartAgent("test", kPort3); 5884 debugger->StartAgent("test", kPort3);
5888 debugger->StopAgent(); 5885 debugger->StopAgent();
5889 5886
5890 delete server; 5887 delete server;
5891
5892 // Test responsiveness after connecting and disconnecting a client.
5893 ok = debugger->StartAgent("test", kPort4);
5894 CHECK(ok);
5895 client = i::OS::CreateSocket();
5896 ok = client->Connect("localhost", port4_str);
5897 CHECK(ok);
5898 ok = client->Receive(&buf, 1) == 1;
5899 CHECK(ok);
5900 ok = client->Send(
5901 "{\"seq\":1,\"type\":\"request\",\"command\":\"disconnect\"}", 49);
5902 CHECK(ok);
5903 client->Shutdown();
5904 delete client;
5905 // Is the server still responsive?
5906 client = i::OS::CreateSocket();
5907 ok = client->Connect("localhost", port4_str);
5908 CHECK(ok);
5909 client->Shutdown();
5910 delete client;
5911 debugger->StopAgent();
5912 } 5888 }
5913 5889
5914 5890
5915 class DebuggerAgentProtocolServerThread : public i::Thread { 5891 class DebuggerAgentProtocolServerThread : public i::Thread {
5916 public: 5892 public:
5917 explicit DebuggerAgentProtocolServerThread(int port) 5893 explicit DebuggerAgentProtocolServerThread(int port)
5918 : Thread("DebuggerAgentProtocolServerThread"), 5894 : Thread("DebuggerAgentProtocolServerThread"),
5919 port_(port), 5895 port_(port),
5920 server_(NULL), 5896 server_(NULL),
5921 client_(NULL), 5897 client_(NULL),
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
7313 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); 7289 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}");
7314 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); 7290 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}");
7315 7291
7316 // Get rid of the debug event listener. 7292 // Get rid of the debug event listener.
7317 v8::Debug::SetDebugEventListener(NULL); 7293 v8::Debug::SetDebugEventListener(NULL);
7318 CheckDebuggerUnloaded(); 7294 CheckDebuggerUnloaded();
7319 } 7295 }
7320 7296
7321 7297
7322 #endif // ENABLE_DEBUGGER_SUPPORT 7298 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698