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

Side by Side Diff: net/base/listen_socket_unittest.h

Issue 368001: Second patch in making destructors of refcounted objects private. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_LISTEN_SOCKET_UNITTEST_H_ 5 #ifndef NET_BASE_LISTEN_SOCKET_UNITTEST_H_
6 #define NET_BASE_LISTEN_SOCKET_UNITTEST_H_ 6 #define NET_BASE_LISTEN_SOCKET_UNITTEST_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 }; 60 };
61 61
62 62
63 // This had to be split out into a separate class because I couldn't 63 // This had to be split out into a separate class because I couldn't
64 // make a the testing::Test class refcounted. 64 // make a the testing::Test class refcounted.
65 class ListenSocketTester : 65 class ListenSocketTester :
66 public ListenSocket::ListenSocketDelegate, 66 public ListenSocket::ListenSocketDelegate,
67 public base::RefCountedThreadSafe<ListenSocketTester> { 67 public base::RefCountedThreadSafe<ListenSocketTester> {
68 68
69 protected: 69 protected:
70 friend class base::RefCountedThreadSafe<ListenSocketTester>;
71
72 virtual ~ListenSocketTester() {}
73
70 virtual ListenSocket* DoListen(); 74 virtual ListenSocket* DoListen();
71 75
72 public: 76 public:
73 ListenSocketTester() 77 ListenSocketTester()
74 : thread_(NULL), 78 : thread_(NULL),
75 loop_(NULL), 79 loop_(NULL),
76 server_(NULL), 80 server_(NULL),
77 connection_(NULL){ 81 connection_(NULL){
78 } 82 }
79 83
80 virtual ~ListenSocketTester() {
81 }
82
83 virtual void SetUp(); 84 virtual void SetUp();
84 virtual void TearDown(); 85 virtual void TearDown();
85 86
86 void ReportAction(const ListenSocketTestAction& action); 87 void ReportAction(const ListenSocketTestAction& action);
87 bool NextAction(int timeout); 88 bool NextAction(int timeout);
88 89
89 // read all pending data from the test socket 90 // read all pending data from the test socket
90 int ClearTestSocket(); 91 int ClearTestSocket();
91 // Release the connection and server sockets 92 // Release the connection and server sockets
92 void Shutdown(); 93 void Shutdown();
(...skipping 22 matching lines...) Expand all
115 MessageLoopForIO* loop_; 116 MessageLoopForIO* loop_;
116 ListenSocket* server_; 117 ListenSocket* server_;
117 ListenSocket* connection_; 118 ListenSocket* connection_;
118 ListenSocketTestAction last_action_; 119 ListenSocketTestAction last_action_;
119 std::deque<ListenSocketTestAction> queue_; 120 std::deque<ListenSocketTestAction> queue_;
120 SOCKET test_socket_; 121 SOCKET test_socket_;
121 static const int kTestPort; 122 static const int kTestPort;
122 }; 123 };
123 124
124 #endif // NET_BASE_LISTEN_SOCKET_UNITTEST_H_ 125 #endif // NET_BASE_LISTEN_SOCKET_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698