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/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "jingle/glue/thread_wrapper.h" | |
13 #include "net/socket/socket.h" | 12 #include "net/socket/socket.h" |
14 #include "net/socket/stream_socket.h" | 13 #include "net/socket/stream_socket.h" |
15 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
16 #include "remoting/base/constants.h" | 15 #include "remoting/base/constants.h" |
17 #include "remoting/jingle_glue/chromium_port_allocator.h" | 16 #include "remoting/jingle_glue/chromium_port_allocator.h" |
18 #include "remoting/jingle_glue/fake_signal_strategy.h" | 17 #include "remoting/jingle_glue/fake_signal_strategy.h" |
19 #include "remoting/jingle_glue/network_settings.h" | 18 #include "remoting/jingle_glue/network_settings.h" |
20 #include "remoting/protocol/authenticator.h" | 19 #include "remoting/protocol/authenticator.h" |
21 #include "remoting/protocol/channel_authenticator.h" | 20 #include "remoting/protocol/channel_authenticator.h" |
22 #include "remoting/protocol/connection_tester.h" | 21 #include "remoting/protocol/connection_tester.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 public: | 87 public: |
89 MOCK_METHOD1(OnDone, void(net::StreamSocket* socket)); | 88 MOCK_METHOD1(OnDone, void(net::StreamSocket* socket)); |
90 }; | 89 }; |
91 | 90 |
92 } // namespace | 91 } // namespace |
93 | 92 |
94 class JingleSessionTest : public testing::Test { | 93 class JingleSessionTest : public testing::Test { |
95 public: | 94 public: |
96 JingleSessionTest() { | 95 JingleSessionTest() { |
97 message_loop_.reset(new base::MessageLoopForIO()); | 96 message_loop_.reset(new base::MessageLoopForIO()); |
98 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | |
99 } | 97 } |
100 | 98 |
101 // Helper method that handles OnIncomingSession(). | 99 // Helper method that handles OnIncomingSession(). |
102 void SetHostSession(Session* session) { | 100 void SetHostSession(Session* session) { |
103 DCHECK(session); | 101 DCHECK(session); |
104 host_session_.reset(session); | 102 host_session_.reset(session); |
105 host_session_->SetEventHandler(&host_session_event_handler_); | 103 host_session_->SetEventHandler(&host_session_event_handler_); |
106 | 104 |
107 session->set_config(SessionConfig::ForTest()); | 105 session->set_config(SessionConfig::ForTest()); |
108 } | 106 } |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 .Times(AtMost(1)); | 512 .Times(AtMost(1)); |
515 ExpectRouteChange(kChannelName); | 513 ExpectRouteChange(kChannelName); |
516 | 514 |
517 message_loop_->Run(); | 515 message_loop_->Run(); |
518 | 516 |
519 EXPECT_TRUE(!host_socket_.get()); | 517 EXPECT_TRUE(!host_socket_.get()); |
520 } | 518 } |
521 | 519 |
522 } // namespace protocol | 520 } // namespace protocol |
523 } // namespace remoting | 521 } // namespace remoting |
OLD | NEW |