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

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

Issue 1420273002: Add TransportSession interface to prepare for WebRTC-based transport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/connection_to_client.h" 5 #include "remoting/protocol/connection_to_client.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 "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 }; 67 };
68 68
69 TEST_F(ConnectionToClientTest, SendUpdateStream) { 69 TEST_F(ConnectionToClientTest, SendUpdateStream) {
70 scoped_ptr<VideoPacket> packet(new VideoPacket()); 70 scoped_ptr<VideoPacket> packet(new VideoPacket());
71 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); 71 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure());
72 72
73 base::RunLoop().RunUntilIdle(); 73 base::RunLoop().RunUntilIdle();
74 74
75 // Verify that something has been written. 75 // Verify that something has been written.
76 // TODO(sergeyu): Verify that the correct data has been written. 76 // TODO(sergeyu): Verify that the correct data has been written.
77 ASSERT_TRUE( 77 FakeStreamSocket* channel = session_->GetTransportSession()
78 session_->fake_channel_factory().GetFakeChannel(kVideoChannelName)); 78 ->GetStreamChannelFactory()
79 EXPECT_FALSE(session_->fake_channel_factory() 79 ->GetFakeChannel(kVideoChannelName);
80 .GetFakeChannel(kVideoChannelName)->written_data().empty()); 80 ASSERT_TRUE(channel);
81 EXPECT_FALSE(channel->written_data().empty());
81 82
82 // And then close the connection to ConnectionToClient. 83 // And then close the connection to ConnectionToClient.
83 viewer_->Disconnect(); 84 viewer_->Disconnect();
84 85
85 base::RunLoop().RunUntilIdle(); 86 base::RunLoop().RunUntilIdle();
86 } 87 }
87 88
88 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { 89 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) {
89 scoped_ptr<VideoPacket> packet(new VideoPacket()); 90 scoped_ptr<VideoPacket> packet(new VideoPacket());
90 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); 91 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure());
(...skipping 13 matching lines...) Expand all
104 base::RunLoop().RunUntilIdle(); 105 base::RunLoop().RunUntilIdle();
105 106
106 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); 107 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED));
107 session_->set_error(SESSION_REJECTED); 108 session_->set_error(SESSION_REJECTED);
108 session_->event_handler()->OnSessionStateChange(Session::FAILED); 109 session_->event_handler()->OnSessionStateChange(Session::FAILED);
109 base::RunLoop().RunUntilIdle(); 110 base::RunLoop().RunUntilIdle();
110 } 111 }
111 112
112 } // namespace protocol 113 } // namespace protocol
113 } // namespace remoting 114 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/client_video_dispatcher_unittest.cc ('k') | remoting/protocol/datagram_channel_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698