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 "base/task.h" | 6 #include "base/task.h" |
7 #include "remoting/base/mock_objects.h" | 7 #include "remoting/base/mock_objects.h" |
8 #include "remoting/host/mock_objects.h" | 8 #include "remoting/host/mock_objects.h" |
9 #include "remoting/host/session_manager.h" | 9 #include "remoting/host/session_manager.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 EXPECT_CALL(*capturer_, width()).WillRepeatedly(Return(kWidth)); | 99 EXPECT_CALL(*capturer_, width()).WillRepeatedly(Return(kWidth)); |
100 EXPECT_CALL(*capturer_, height()).WillRepeatedly(Return(kHeight)); | 100 EXPECT_CALL(*capturer_, height()).WillRepeatedly(Return(kHeight)); |
101 EXPECT_CALL(*client_, SendInitClientMessage(kWidth, kHeight)); | 101 EXPECT_CALL(*client_, SendInitClientMessage(kWidth, kHeight)); |
102 record_->AddClient(client_); | 102 record_->AddClient(client_); |
103 | 103 |
104 // First the capturer is called. | 104 // First the capturer is called. |
105 EXPECT_CALL(*capturer_, CaptureInvalidRects(NotNull())) | 105 EXPECT_CALL(*capturer_, CaptureInvalidRects(NotNull())) |
106 .WillOnce(RunCallback(update_rects, data)); | 106 .WillOnce(RunCallback(update_rects, data)); |
107 | 107 |
108 // Expect the encoder be called. | 108 // Expect the encoder be called. |
109 ChromotingHostMessage* msg = new ChromotingHostMessage(); | 109 HostMessage* msg = new HostMessage(); |
110 EXPECT_CALL(*encoder_, Encode(data, false, NotNull())) | 110 EXPECT_CALL(*encoder_, Encode(data, false, NotNull())) |
111 .WillOnce(FinishEncode(msg)); | 111 .WillOnce(FinishEncode(msg)); |
112 | 112 |
113 // Expect the client be notified. | 113 // Expect the client be notified. |
114 EXPECT_CALL(*client_, SendBeginUpdateStreamMessage()); | 114 EXPECT_CALL(*client_, SendBeginUpdateStreamMessage()); |
115 EXPECT_CALL(*client_, SendUpdateStreamPacketMessage(_)); | 115 EXPECT_CALL(*client_, SendUpdateStreamPacketMessage(_)); |
116 EXPECT_CALL(*client_, SendEndUpdateStreamMessage()); | 116 EXPECT_CALL(*client_, SendEndUpdateStreamMessage()); |
117 EXPECT_CALL(*client_, GetPendingUpdateStreamMessages()) | 117 EXPECT_CALL(*client_, GetPendingUpdateStreamMessages()) |
118 .Times(AtLeast(0)) | 118 .Times(AtLeast(0)) |
119 .WillRepeatedly(Return(0)); | 119 .WillRepeatedly(Return(0)); |
120 | 120 |
121 // Start the recording. | 121 // Start the recording. |
122 record_->Start(); | 122 record_->Start(); |
123 | 123 |
124 // Make sure all tasks are completed. | 124 // Make sure all tasks are completed. |
125 message_loop_.RunAllPending(); | 125 message_loop_.RunAllPending(); |
126 } | 126 } |
127 | 127 |
128 // TODO(hclam): Add test for double buffering. | 128 // TODO(hclam): Add test for double buffering. |
129 // TODO(hclam): Add test for multiple captures. | 129 // TODO(hclam): Add test for multiple captures. |
130 // TODO(hclam): Add test for interruption. | 130 // TODO(hclam): Add test for interruption. |
131 | 131 |
132 } // namespace remoting | 132 } // namespace remoting |
OLD | NEW |