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 "jingle/glue/thread_wrapper.h" |
13 #include "net/socket/socket.h" | 13 #include "net/socket/socket.h" |
14 #include "net/socket/stream_socket.h" | 14 #include "net/socket/stream_socket.h" |
15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
16 #include "remoting/base/constants.h" | 16 #include "remoting/base/constants.h" |
17 #include "remoting/protocol/authenticator.h" | 17 #include "remoting/protocol/authenticator.h" |
18 #include "remoting/protocol/channel_authenticator.h" | 18 #include "remoting/protocol/channel_authenticator.h" |
19 #include "remoting/protocol/channel_factory.h" | |
19 #include "remoting/protocol/chromium_port_allocator.h" | 20 #include "remoting/protocol/chromium_port_allocator.h" |
20 #include "remoting/protocol/connection_tester.h" | 21 #include "remoting/protocol/connection_tester.h" |
21 #include "remoting/protocol/fake_authenticator.h" | 22 #include "remoting/protocol/fake_authenticator.h" |
22 #include "remoting/protocol/jingle_session_manager.h" | 23 #include "remoting/protocol/jingle_session_manager.h" |
23 #include "remoting/protocol/libjingle_transport_factory.h" | 24 #include "remoting/protocol/libjingle_transport_factory.h" |
24 #include "remoting/protocol/network_settings.h" | 25 #include "remoting/protocol/network_settings.h" |
25 #include "remoting/signaling/fake_signal_strategy.h" | 26 #include "remoting/signaling/fake_signal_strategy.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
28 | 29 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 | 502 |
502 client_session_->GetTransportChannelFactory()->CreateChannel( | 503 client_session_->GetTransportChannelFactory()->CreateChannel( |
503 kChannelName, base::Bind(&JingleSessionTest::OnClientChannelCreated, | 504 kChannelName, base::Bind(&JingleSessionTest::OnClientChannelCreated, |
504 base::Unretained(this))); | 505 base::Unretained(this))); |
505 host_session_->GetTransportChannelFactory()->CreateChannel( | 506 host_session_->GetTransportChannelFactory()->CreateChannel( |
506 kChannelName, base::Bind(&JingleSessionTest::OnHostChannelCreated, | 507 kChannelName, base::Bind(&JingleSessionTest::OnHostChannelCreated, |
507 base::Unretained(this))); | 508 base::Unretained(this))); |
508 | 509 |
509 // Terminate the message loop when we get rejection notification | 510 // Terminate the message loop when we get rejection notification |
510 // from the host. | 511 // from the host. |
512 bool client_callback_called = false; | |
511 EXPECT_CALL(host_channel_callback_, OnDone(NULL)) | 513 EXPECT_CALL(host_channel_callback_, OnDone(NULL)) |
512 .WillOnce(QuitThread()); | 514 .WillOnce(QuitThread()); |
513 EXPECT_CALL(client_channel_callback_, OnDone(_)) | 515 EXPECT_CALL(client_channel_callback_, OnDone(_)) |
514 .Times(AtMost(1)); | 516 .Times(AtMost(1)) |
517 .WillOnce(testing::Assign(&client_callback_called, true)); | |
515 ExpectRouteChange(kChannelName); | 518 ExpectRouteChange(kChannelName); |
516 | 519 |
517 message_loop_->Run(); | 520 message_loop_->Run(); |
518 | 521 |
522 if (!client_callback_called) { | |
Wez
2014/09/10 02:29:26
Why would the callback not be called, after this c
Sergey Ulanov
2014/09/10 21:50:59
It's not called and DCHECKs were failing because C
Wez
2014/09/10 22:19:41
Should we make the test ordering deterministic, an
Sergey Ulanov
2014/09/10 22:49:30
Done. I don't think we need two tests here - this
| |
523 client_session_->GetTransportChannelFactory()->CancelChannelCreation( | |
524 kChannelName); | |
525 } | |
526 | |
519 EXPECT_TRUE(!host_socket_.get()); | 527 EXPECT_TRUE(!host_socket_.get()); |
520 } | 528 } |
521 | 529 |
522 } // namespace protocol | 530 } // namespace protocol |
523 } // namespace remoting | 531 } // namespace remoting |
OLD | NEW |