OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/protocol/channel_multiplexer.h" | 5 #include "remoting/protocol/channel_multiplexer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/socket/socket.h" | 10 #include "net/socket/socket.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 const int kMessageSize = 1024; | 27 const int kMessageSize = 1024; |
28 const int kMessages = 100; | 28 const int kMessages = 100; |
29 const char kMuxChannelName[] = "mux"; | 29 const char kMuxChannelName[] = "mux"; |
30 | 30 |
31 const char kTestChannelName[] = "test"; | 31 const char kTestChannelName[] = "test"; |
32 const char kTestChannelName2[] = "test2"; | 32 const char kTestChannelName2[] = "test2"; |
33 | 33 |
34 | 34 |
35 void QuitCurrentThread() { | 35 void QuitCurrentThread() { |
36 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 36 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 37 base::MessageLoop::QuitClosure()); |
37 } | 38 } |
38 | 39 |
39 class MockSocketCallback { | 40 class MockSocketCallback { |
40 public: | 41 public: |
41 MOCK_METHOD1(OnDone, void(int result)); | 42 MOCK_METHOD1(OnDone, void(int result)); |
42 }; | 43 }; |
43 | 44 |
44 class MockConnectCallback { | 45 class MockConnectCallback { |
45 public: | 46 public: |
46 MOCK_METHOD1(OnConnectedPtr, void(net::StreamSocket* socket)); | 47 MOCK_METHOD1(OnConnectedPtr, void(net::StreamSocket* socket)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 119 |
119 scoped_refptr<net::IOBufferWithSize> CreateTestBuffer(int size) { | 120 scoped_refptr<net::IOBufferWithSize> CreateTestBuffer(int size) { |
120 scoped_refptr<net::IOBufferWithSize> result = | 121 scoped_refptr<net::IOBufferWithSize> result = |
121 new net::IOBufferWithSize(size); | 122 new net::IOBufferWithSize(size); |
122 for (int i = 0; i< size; ++i) { | 123 for (int i = 0; i< size; ++i) { |
123 result->data()[i] = rand() % 256; | 124 result->data()[i] = rand() % 256; |
124 } | 125 } |
125 return result; | 126 return result; |
126 } | 127 } |
127 | 128 |
128 MessageLoop message_loop_; | 129 base::MessageLoop message_loop_; |
129 | 130 |
130 FakeSession host_session_; | 131 FakeSession host_session_; |
131 FakeSession client_session_; | 132 FakeSession client_session_; |
132 | 133 |
133 scoped_ptr<ChannelMultiplexer> host_mux_; | 134 scoped_ptr<ChannelMultiplexer> host_mux_; |
134 scoped_ptr<ChannelMultiplexer> client_mux_; | 135 scoped_ptr<ChannelMultiplexer> client_mux_; |
135 | 136 |
136 scoped_ptr<net::StreamSocket> host_socket1_; | 137 scoped_ptr<net::StreamSocket> host_socket1_; |
137 scoped_ptr<net::StreamSocket> client_socket1_; | 138 scoped_ptr<net::StreamSocket> client_socket1_; |
138 scoped_ptr<net::StreamSocket> host_socket2_; | 139 scoped_ptr<net::StreamSocket> host_socket2_; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 .WillOnce(InvokeWithoutArgs( | 350 .WillOnce(InvokeWithoutArgs( |
350 this, &ChannelMultiplexerTest::DeleteAfterSessionFail)); | 351 this, &ChannelMultiplexerTest::DeleteAfterSessionFail)); |
351 EXPECT_CALL(cb2, OnConnectedPtr(_)) | 352 EXPECT_CALL(cb2, OnConnectedPtr(_)) |
352 .Times(0); | 353 .Times(0); |
353 | 354 |
354 message_loop_.RunUntilIdle(); | 355 message_loop_.RunUntilIdle(); |
355 } | 356 } |
356 | 357 |
357 } // namespace protocol | 358 } // namespace protocol |
358 } // namespace remoting | 359 } // namespace remoting |
OLD | NEW |