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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
12 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
13 #include "net/socket/socket.h" | 16 #include "net/socket/socket.h" |
14 #include "net/socket/stream_socket.h" | 17 #include "net/socket/stream_socket.h" |
15 #include "remoting/base/constants.h" | 18 #include "remoting/base/constants.h" |
16 #include "remoting/protocol/connection_tester.h" | 19 #include "remoting/protocol/connection_tester.h" |
17 #include "remoting/protocol/fake_stream_socket.h" | 20 #include "remoting/protocol/fake_stream_socket.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
20 | 23 |
21 using testing::_; | 24 using testing::_; |
22 using testing::AtMost; | 25 using testing::AtMost; |
23 using testing::InvokeWithoutArgs; | 26 using testing::InvokeWithoutArgs; |
24 | 27 |
25 namespace remoting { | 28 namespace remoting { |
26 namespace protocol { | 29 namespace protocol { |
27 | 30 |
28 namespace { | 31 namespace { |
29 | 32 |
30 const int kMessageSize = 1024; | 33 const int kMessageSize = 1024; |
31 const int kMessages = 100; | 34 const int kMessages = 100; |
32 const char kMuxChannelName[] = "mux"; | 35 const char kMuxChannelName[] = "mux"; |
33 | 36 |
34 const char kTestChannelName[] = "test"; | 37 const char kTestChannelName[] = "test"; |
35 const char kTestChannelName2[] = "test2"; | 38 const char kTestChannelName2[] = "test2"; |
36 | 39 |
37 | 40 |
38 void QuitCurrentThread() { | 41 void QuitCurrentThread() { |
39 base::MessageLoop::current()->PostTask( | 42 base::ThreadTaskRunnerHandle::Get()->PostTask( |
40 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 43 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
41 } | 44 } |
42 | 45 |
43 class MockSocketCallback { | 46 class MockSocketCallback { |
44 public: | 47 public: |
45 MOCK_METHOD1(OnDone, void(int result)); | 48 MOCK_METHOD1(OnDone, void(int result)); |
46 }; | 49 }; |
47 | 50 |
48 class MockConnectCallback { | 51 class MockConnectCallback { |
49 public: | 52 public: |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 .WillOnce(InvokeWithoutArgs( | 347 .WillOnce(InvokeWithoutArgs( |
345 this, &ChannelMultiplexerTest::DeleteAfterSessionFail)); | 348 this, &ChannelMultiplexerTest::DeleteAfterSessionFail)); |
346 EXPECT_CALL(cb2, OnConnectedPtr(_)) | 349 EXPECT_CALL(cb2, OnConnectedPtr(_)) |
347 .Times(0); | 350 .Times(0); |
348 | 351 |
349 base::RunLoop().RunUntilIdle(); | 352 base::RunLoop().RunUntilIdle(); |
350 } | 353 } |
351 | 354 |
352 } // namespace protocol | 355 } // namespace protocol |
353 } // namespace remoting | 356 } // namespace remoting |
OLD | NEW |