| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "media/base/data_buffer.h" | 6 #include "media/base/data_buffer.h" |
| 7 #include "remoting/base/mock_objects.h" | 7 #include "remoting/base/mock_objects.h" |
| 8 #include "remoting/host/client_connection.h" | 8 #include "remoting/host/client_connection.h" |
| 9 #include "remoting/host/mock_objects.h" | 9 #include "remoting/host/mock_objects.h" |
| 10 #include "remoting/jingle_glue/mock_objects.h" | 10 #include "remoting/jingle_glue/mock_objects.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DISALLOW_COPY_AND_ASSIGN(ClientConnectionTest); | 48 DISALLOW_COPY_AND_ASSIGN(ClientConnectionTest); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 TEST_F(ClientConnectionTest, SendUpdateStream) { | 51 TEST_F(ClientConnectionTest, SendUpdateStream) { |
| 52 // Tell the viewer we are starting an update stream. | 52 // Tell the viewer we are starting an update stream. |
| 53 EXPECT_CALL(*channel_, Write(_)); | 53 EXPECT_CALL(*channel_, Write(_)); |
| 54 viewer_->SendBeginUpdateStreamMessage(); | 54 viewer_->SendBeginUpdateStreamMessage(); |
| 55 | 55 |
| 56 // Then send the actual data. | 56 // Then send the actual data. |
| 57 EXPECT_CALL(*channel_, Write(_)); | 57 EXPECT_CALL(*channel_, Write(_)); |
| 58 scoped_ptr<UpdateStreamPacketHeader> header(new UpdateStreamPacketHeader); | |
| 59 header->set_x(0); | |
| 60 header->set_y(0); | |
| 61 header->set_width(640); | |
| 62 header->set_height(480); | |
| 63 | |
| 64 scoped_refptr<media::DataBuffer> data = new media::DataBuffer(10); | 58 scoped_refptr<media::DataBuffer> data = new media::DataBuffer(10); |
| 65 viewer_->SendUpdateStreamPacketMessage(header.get(), data); | 59 viewer_->SendUpdateStreamPacketMessage(data); |
| 66 | 60 |
| 67 // Send the end of update message. | 61 // Send the end of update message. |
| 68 EXPECT_CALL(*channel_, Write(_)); | 62 EXPECT_CALL(*channel_, Write(_)); |
| 69 viewer_->SendEndUpdateStreamMessage(); | 63 viewer_->SendEndUpdateStreamMessage(); |
| 70 | 64 |
| 71 // And then close the connection to ClientConnection. | 65 // And then close the connection to ClientConnection. |
| 72 EXPECT_CALL(*channel_, Close()); | 66 EXPECT_CALL(*channel_, Close()); |
| 73 viewer_->Disconnect(); | 67 viewer_->Disconnect(); |
| 74 } | 68 } |
| 75 | 69 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 98 viewer_->OnPacketReceived(channel_.get(), data); | 92 viewer_->OnPacketReceived(channel_.get(), data); |
| 99 message_loop_.RunAllPending(); | 93 message_loop_.RunAllPending(); |
| 100 } | 94 } |
| 101 | 95 |
| 102 // Test that we can close client connection more than once and operations | 96 // Test that we can close client connection more than once and operations |
| 103 // after the connection is closed has no effect. | 97 // after the connection is closed has no effect. |
| 104 TEST_F(ClientConnectionTest, Close) { | 98 TEST_F(ClientConnectionTest, Close) { |
| 105 EXPECT_CALL(*channel_, Close()); | 99 EXPECT_CALL(*channel_, Close()); |
| 106 viewer_->Disconnect(); | 100 viewer_->Disconnect(); |
| 107 | 101 |
| 108 viewer_->SendBeginUpdateStreamMessage(); | |
| 109 scoped_ptr<UpdateStreamPacketHeader> header(new UpdateStreamPacketHeader); | |
| 110 header->set_x(0); | |
| 111 header->set_y(0); | |
| 112 header->set_width(640); | |
| 113 header->set_height(480); | |
| 114 | |
| 115 scoped_refptr<media::DataBuffer> data = new media::DataBuffer(10); | 102 scoped_refptr<media::DataBuffer> data = new media::DataBuffer(10); |
| 116 viewer_->SendUpdateStreamPacketMessage(header.get(), data); | 103 viewer_->SendUpdateStreamPacketMessage(data); |
| 117 viewer_->SendEndUpdateStreamMessage(); | 104 viewer_->SendEndUpdateStreamMessage(); |
| 118 viewer_->Disconnect(); | 105 viewer_->Disconnect(); |
| 119 } | 106 } |
| 120 | 107 |
| 121 } // namespace remoting | 108 } // namespace remoting |
| OLD | NEW |