| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "remoting/base/base_mock_objects.h" | 6 #include "remoting/base/base_mock_objects.h" |
| 7 #include "remoting/base/constants.h" |
| 7 #include "remoting/protocol/fake_session.h" | 8 #include "remoting/protocol/fake_session.h" |
| 8 #include "remoting/protocol/connection_to_client.h" | 9 #include "remoting/protocol/connection_to_client.h" |
| 9 #include "remoting/protocol/protocol_mock_objects.h" | 10 #include "remoting/protocol/protocol_mock_objects.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 11 | 12 |
| 12 using ::testing::_; | 13 using ::testing::_; |
| 13 using ::testing::NotNull; | 14 using ::testing::NotNull; |
| 14 using ::testing::StrictMock; | 15 using ::testing::StrictMock; |
| 15 | 16 |
| 16 namespace remoting { | 17 namespace remoting { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 TEST_F(ConnectionToClientTest, SendUpdateStream) { | 54 TEST_F(ConnectionToClientTest, SendUpdateStream) { |
| 54 // Then send the actual data. | 55 // Then send the actual data. |
| 55 VideoPacket* packet = new VideoPacket(); | 56 VideoPacket* packet = new VideoPacket(); |
| 56 viewer_->video_stub()->ProcessVideoPacket( | 57 viewer_->video_stub()->ProcessVideoPacket( |
| 57 packet, new DeleteTask<VideoPacket>(packet)); | 58 packet, new DeleteTask<VideoPacket>(packet)); |
| 58 | 59 |
| 59 message_loop_.RunAllPending(); | 60 message_loop_.RunAllPending(); |
| 60 | 61 |
| 61 // Verify that something has been written. | 62 // Verify that something has been written. |
| 62 // TODO(sergeyu): Verify that the correct data has been written. | 63 // TODO(sergeyu): Verify that the correct data has been written. |
| 63 EXPECT_GT(session_->video_channel()->written_data().size(), 0u); | 64 ASSERT_TRUE(session_->GetStreamChannel(kVideoChannelName)); |
| 65 EXPECT_GT(session_->GetStreamChannel(kVideoChannelName)-> |
| 66 written_data().size(), 0u); |
| 64 | 67 |
| 65 // And then close the connection to ConnectionToClient. | 68 // And then close the connection to ConnectionToClient. |
| 66 viewer_->Disconnect(); | 69 viewer_->Disconnect(); |
| 67 | 70 |
| 68 message_loop_.RunAllPending(); | 71 message_loop_.RunAllPending(); |
| 69 } | 72 } |
| 70 | 73 |
| 71 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { | 74 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { |
| 72 // Then send the actual data. | 75 // Then send the actual data. |
| 73 VideoPacket* packet = new VideoPacket(); | 76 VideoPacket* packet = new VideoPacket(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 96 // Test that we can close client connection more than once. | 99 // Test that we can close client connection more than once. |
| 97 TEST_F(ConnectionToClientTest, Close) { | 100 TEST_F(ConnectionToClientTest, Close) { |
| 98 viewer_->Disconnect(); | 101 viewer_->Disconnect(); |
| 99 message_loop_.RunAllPending(); | 102 message_loop_.RunAllPending(); |
| 100 viewer_->Disconnect(); | 103 viewer_->Disconnect(); |
| 101 message_loop_.RunAllPending(); | 104 message_loop_.RunAllPending(); |
| 102 } | 105 } |
| 103 | 106 |
| 104 } // namespace protocol | 107 } // namespace protocol |
| 105 } // namespace remoting | 108 } // namespace remoting |
| OLD | NEW |