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

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

Issue 1277093006: Enable QUIC support in chromoting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@quic_adapters
Patch Set: Created 5 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
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/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"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 EXPECT_CALL(client_session_event_handler_, 396 EXPECT_CALL(client_session_event_handler_,
397 OnSessionStateChange(Session::FAILED)) 397 OnSessionStateChange(Session::FAILED))
398 .Times(1); 398 .Times(1);
399 399
400 scoped_ptr<Authenticator> authenticator(new FakeAuthenticator( 400 scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
401 FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true)); 401 FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true));
402 402
403 scoped_ptr<CandidateSessionConfig> config = 403 scoped_ptr<CandidateSessionConfig> config =
404 CandidateSessionConfig::CreateDefault(); 404 CandidateSessionConfig::CreateDefault();
405 // Disable all video codecs so the host will reject connection 405 // Disable all video codecs so the host will reject connection.
406 config->mutable_video_configs()->clear(); 406 config->mutable_video_configs()->clear();
407 client_server_->set_protocol_config(config.Pass()); 407 client_server_->set_protocol_config(config.Pass());
408 client_session_ = client_server_->Connect(kHostJid, authenticator.Pass()); 408 client_session_ = client_server_->Connect(kHostJid, authenticator.Pass());
409 client_session_->SetEventHandler(&client_session_event_handler_); 409 client_session_->SetEventHandler(&client_session_event_handler_);
410 410
411 base::RunLoop().RunUntilIdle(); 411 base::RunLoop().RunUntilIdle();
412 412
413 EXPECT_EQ(INCOMPATIBLE_PROTOCOL, client_session_->error()); 413 EXPECT_EQ(INCOMPATIBLE_PROTOCOL, client_session_->error());
414 EXPECT_FALSE(host_session_); 414 EXPECT_FALSE(host_session_);
415 } 415 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 EXPECT_TRUE(client_socket_.get()); 514 EXPECT_TRUE(client_socket_.get());
515 EXPECT_TRUE(host_socket_.get()); 515 EXPECT_TRUE(host_socket_.get());
516 516
517 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), 517 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(),
518 kMessageSize, kMessages); 518 kMessageSize, kMessages);
519 tester.Start(); 519 tester.Start();
520 message_loop_->Run(); 520 message_loop_->Run();
521 tester.CheckResults(); 521 tester.CheckResults();
522 } 522 }
523 523
524 // Verify that data can be sent over a QUIC channel.
525 TEST_F(JingleSessionTest, TestQuicStreamChannel) {
526 CreateSessionManagers(1, FakeAuthenticator::ACCEPT);
527
528 scoped_ptr<CandidateSessionConfig> config =
529 CandidateSessionConfig::CreateDefault();
530 config->PreferTransport(ChannelConfig::TRANSPORT_QUIC_STREAM);
531 client_server_->set_protocol_config(config.Pass());
532
533 ASSERT_NO_FATAL_FAILURE(
534 InitiateConnection(1, FakeAuthenticator::ACCEPT, false));
535
536 int counter = 2;
537 ExpectRouteChange(kQuicChannelName);
538 EXPECT_CALL(client_channel_callback_, OnDone(_))
539 .WillOnce(QuitThreadOnCounter(&counter));
540 EXPECT_CALL(host_channel_callback_, OnDone(_))
541 .WillOnce(QuitThreadOnCounter(&counter));
542
543 client_session_->GetQuicChannelFactory()->CreateChannel(
544 kChannelName, base::Bind(&JingleSessionTest::OnClientChannelCreated,
545 base::Unretained(this)));
546 host_session_->GetQuicChannelFactory()->CreateChannel(
547 kChannelName, base::Bind(&JingleSessionTest::OnHostChannelCreated,
548 base::Unretained(this)));
549
550 message_loop_->Run();
551
552 EXPECT_TRUE(client_socket_.get());
553 EXPECT_TRUE(host_socket_.get());
554
555 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(),
556 kMessageSize, kMessages);
557 tester.Start();
558 message_loop_->Run();
559 tester.CheckResults();
560 }
561
524 // Verify that we can connect channels with multistep auth. 562 // Verify that we can connect channels with multistep auth.
525 TEST_F(JingleSessionTest, TestMultistepAuthStreamChannel) { 563 TEST_F(JingleSessionTest, TestMultistepAuthStreamChannel) {
526 CreateSessionManagers(3, FakeAuthenticator::ACCEPT); 564 CreateSessionManagers(3, FakeAuthenticator::ACCEPT);
527 ASSERT_NO_FATAL_FAILURE( 565 ASSERT_NO_FATAL_FAILURE(
528 InitiateConnection(3, FakeAuthenticator::ACCEPT, false)); 566 InitiateConnection(3, FakeAuthenticator::ACCEPT, false));
529 567
530 ASSERT_NO_FATAL_FAILURE(CreateChannel()); 568 ASSERT_NO_FATAL_FAILURE(CreateChannel());
531 569
532 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), 570 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(),
533 kMessageSize, kMessages); 571 kMessageSize, kMessages);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 629
592 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), 630 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(),
593 kMessageSize, 1); 631 kMessageSize, 1);
594 tester.Start(); 632 tester.Start();
595 message_loop_->Run(); 633 message_loop_->Run();
596 tester.CheckResults(); 634 tester.CheckResults();
597 } 635 }
598 636
599 } // namespace protocol 637 } // namespace protocol
600 } // namespace remoting 638 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/me2me_host_authenticator_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698