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