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

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

Issue 10815023: [Chromoting] Fix unit test warnings introduced in r146455. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set expectations more accurately." Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/jingle_thread.h"
21 #include "remoting/jingle_glue/fake_signal_strategy.h" 21 #include "remoting/jingle_glue/fake_signal_strategy.h"
22 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 using testing::_; 25 using testing::_;
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;
30 using testing::Invoke; 31 using testing::Invoke;
31 using testing::InvokeWithoutArgs; 32 using testing::InvokeWithoutArgs;
32 using testing::Return; 33 using testing::Return;
33 using testing::SaveArg; 34 using testing::SaveArg;
34 using testing::SetArgumentPointee; 35 using testing::SetArgumentPointee;
35 using testing::WithArg; 36 using testing::WithArg;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 message_loop_->RunAllPending(); 230 message_loop_->RunAllPending();
230 } 231 }
231 232
232 void CreateChannel() { 233 void CreateChannel() {
233 client_session_->CreateStreamChannel(kChannelName, base::Bind( 234 client_session_->CreateStreamChannel(kChannelName, base::Bind(
234 &JingleSessionTest::OnClientChannelCreated, base::Unretained(this))); 235 &JingleSessionTest::OnClientChannelCreated, base::Unretained(this)));
235 host_session_->CreateStreamChannel(kChannelName, base::Bind( 236 host_session_->CreateStreamChannel(kChannelName, base::Bind(
236 &JingleSessionTest::OnHostChannelCreated, base::Unretained(this))); 237 &JingleSessionTest::OnHostChannelCreated, base::Unretained(this)));
237 238
238 int counter = 2; 239 int counter = 2;
240 ExpectRouteChange();
239 EXPECT_CALL(client_channel_callback_, OnDone(_)) 241 EXPECT_CALL(client_channel_callback_, OnDone(_))
240 .WillOnce(QuitThreadOnCounter(&counter)); 242 .WillOnce(QuitThreadOnCounter(&counter));
241 EXPECT_CALL(host_channel_callback_, OnDone(_)) 243 EXPECT_CALL(host_channel_callback_, OnDone(_))
242 .WillOnce(QuitThreadOnCounter(&counter)); 244 .WillOnce(QuitThreadOnCounter(&counter));
243 message_loop_->Run(); 245 message_loop_->Run();
244 246
245 EXPECT_TRUE(client_socket_.get()); 247 EXPECT_TRUE(client_socket_.get());
246 EXPECT_TRUE(host_socket_.get()); 248 EXPECT_TRUE(host_socket_.get());
247 } 249 }
248 250
251 void ExpectRouteChange() {
252 EXPECT_CALL(host_session_event_handler_,
253 OnSessionRouteChange(kChannelName, _))
254 .Times(AtLeast(1));
255 EXPECT_CALL(client_session_event_handler_,
256 OnSessionRouteChange(kChannelName, _))
257 .Times(AtLeast(1));
258 }
259
249 scoped_ptr<JingleThreadMessageLoop> message_loop_; 260 scoped_ptr<JingleThreadMessageLoop> message_loop_;
250 261
251 scoped_ptr<FakeSignalStrategy> host_signal_strategy_; 262 scoped_ptr<FakeSignalStrategy> host_signal_strategy_;
252 scoped_ptr<FakeSignalStrategy> client_signal_strategy_; 263 scoped_ptr<FakeSignalStrategy> client_signal_strategy_;
253 264
254 scoped_ptr<JingleSessionManager> host_server_; 265 scoped_ptr<JingleSessionManager> host_server_;
255 MockSessionManagerListener host_server_listener_; 266 MockSessionManagerListener host_server_listener_;
256 scoped_ptr<JingleSessionManager> client_server_; 267 scoped_ptr<JingleSessionManager> client_server_;
257 MockSessionManagerListener client_server_listener_; 268 MockSessionManagerListener client_server_listener_;
258 269
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 &JingleSessionTest::OnClientChannelCreated, base::Unretained(this))); 385 &JingleSessionTest::OnClientChannelCreated, base::Unretained(this)));
375 host_session_->CreateStreamChannel(kChannelName, base::Bind( 386 host_session_->CreateStreamChannel(kChannelName, base::Bind(
376 &JingleSessionTest::OnHostChannelCreated, base::Unretained(this))); 387 &JingleSessionTest::OnHostChannelCreated, base::Unretained(this)));
377 388
378 // Terminate the message loop when we get rejection notification 389 // Terminate the message loop when we get rejection notification
379 // from the host. 390 // from the host.
380 EXPECT_CALL(host_channel_callback_, OnDone(NULL)) 391 EXPECT_CALL(host_channel_callback_, OnDone(NULL))
381 .WillOnce(QuitThread()); 392 .WillOnce(QuitThread());
382 EXPECT_CALL(client_channel_callback_, OnDone(_)) 393 EXPECT_CALL(client_channel_callback_, OnDone(_))
383 .Times(AtMost(1)); 394 .Times(AtMost(1));
395 ExpectRouteChange();
384 396
385 message_loop_->Run(); 397 message_loop_->Run();
386 398
387 EXPECT_TRUE(!host_socket_.get()); 399 EXPECT_TRUE(!host_socket_.get());
388 } 400 }
389 401
390 } // namespace protocol 402 } // namespace protocol
391 } // namespace remoting 403 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698