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

Side by Side Diff: remoting/protocol/jingle_session_unittest.cc

Issue 10829040: Revert 148418 - Always use chromium threads for IO in remoting host (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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) 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.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
11 #include "net/socket/socket.h" 11 #include "net/socket/socket.h"
12 #include "net/socket/stream_socket.h" 12 #include "net/socket/stream_socket.h"
13 #include "remoting/base/constants.h" 13 #include "remoting/base/constants.h"
14 #include "remoting/protocol/authenticator.h" 14 #include "remoting/protocol/authenticator.h"
15 #include "remoting/protocol/channel_authenticator.h" 15 #include "remoting/protocol/channel_authenticator.h"
16 #include "remoting/protocol/connection_tester.h" 16 #include "remoting/protocol/connection_tester.h"
17 #include "remoting/protocol/fake_authenticator.h" 17 #include "remoting/protocol/fake_authenticator.h"
18 #include "remoting/protocol/jingle_session_manager.h" 18 #include "remoting/protocol/jingle_session_manager.h"
19 #include "remoting/protocol/libjingle_transport_factory.h" 19 #include "remoting/protocol/libjingle_transport_factory.h"
20 #include "remoting/jingle_glue/jingle_thread.h"
20 #include "remoting/jingle_glue/fake_signal_strategy.h" 21 #include "remoting/jingle_glue/fake_signal_strategy.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 24
24 using testing::_; 25 using testing::_;
25 using testing::AtLeast; 26 using testing::AtLeast;
26 using testing::AtMost; 27 using testing::AtMost;
27 using testing::DeleteArg; 28 using testing::DeleteArg;
28 using testing::DoAll; 29 using testing::DoAll;
29 using testing::InSequence; 30 using testing::InSequence;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 class MockStreamChannelCallback { 82 class MockStreamChannelCallback {
82 public: 83 public:
83 MOCK_METHOD1(OnDone, void(net::StreamSocket* socket)); 84 MOCK_METHOD1(OnDone, void(net::StreamSocket* socket));
84 }; 85 };
85 86
86 } // namespace 87 } // namespace
87 88
88 class JingleSessionTest : public testing::Test { 89 class JingleSessionTest : public testing::Test {
89 public: 90 public:
90 JingleSessionTest() { 91 JingleSessionTest() {
91 message_loop_.reset(new MessageLoopForIO()); 92 talk_base::ThreadManager::Instance()->WrapCurrentThread();
93 message_loop_.reset(
94 new JingleThreadMessageLoop(talk_base::Thread::Current()));
92 } 95 }
93 96
94 // Helper method that handles OnIncomingSession(). 97 // Helper method that handles OnIncomingSession().
95 void SetHostSession(Session* session) { 98 void SetHostSession(Session* session) {
96 DCHECK(session); 99 DCHECK(session);
97 host_session_.reset(session); 100 host_session_.reset(session);
98 host_session_->SetEventHandler(&host_session_event_handler_); 101 host_session_->SetEventHandler(&host_session_event_handler_);
99 102
100 session->set_config(SessionConfig::GetDefault()); 103 session->set_config(SessionConfig::GetDefault());
101 } 104 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 250
248 void ExpectRouteChange() { 251 void ExpectRouteChange() {
249 EXPECT_CALL(host_session_event_handler_, 252 EXPECT_CALL(host_session_event_handler_,
250 OnSessionRouteChange(kChannelName, _)) 253 OnSessionRouteChange(kChannelName, _))
251 .Times(AtLeast(1)); 254 .Times(AtLeast(1));
252 EXPECT_CALL(client_session_event_handler_, 255 EXPECT_CALL(client_session_event_handler_,
253 OnSessionRouteChange(kChannelName, _)) 256 OnSessionRouteChange(kChannelName, _))
254 .Times(AtLeast(1)); 257 .Times(AtLeast(1));
255 } 258 }
256 259
257 scoped_ptr<MessageLoopForIO> message_loop_; 260 scoped_ptr<JingleThreadMessageLoop> message_loop_;
258 261
259 scoped_ptr<FakeSignalStrategy> host_signal_strategy_; 262 scoped_ptr<FakeSignalStrategy> host_signal_strategy_;
260 scoped_ptr<FakeSignalStrategy> client_signal_strategy_; 263 scoped_ptr<FakeSignalStrategy> client_signal_strategy_;
261 264
262 scoped_ptr<JingleSessionManager> host_server_; 265 scoped_ptr<JingleSessionManager> host_server_;
263 MockSessionManagerListener host_server_listener_; 266 MockSessionManagerListener host_server_listener_;
264 scoped_ptr<JingleSessionManager> client_server_; 267 scoped_ptr<JingleSessionManager> client_server_;
265 MockSessionManagerListener client_server_listener_; 268 MockSessionManagerListener client_server_listener_;
266 269
267 scoped_ptr<Session> host_session_; 270 scoped_ptr<Session> host_session_;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 .Times(AtMost(1)); 394 .Times(AtMost(1));
392 ExpectRouteChange(); 395 ExpectRouteChange();
393 396
394 message_loop_->Run(); 397 message_loop_->Run();
395 398
396 EXPECT_TRUE(!host_socket_.get()); 399 EXPECT_TRUE(!host_socket_.get());
397 } 400 }
398 401
399 } // namespace protocol 402 } // namespace protocol
400 } // namespace remoting 403 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/jingle_glue/xmpp_socket_adapter.cc ('k') | remoting/protocol/libjingle_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698