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/host/mock_objects.h" | 8 #include "remoting/host/mock_objects.h" |
8 #include "remoting/host/session_manager.h" | 9 #include "remoting/host/session_manager.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 using ::testing::_; | 13 using ::testing::_; |
13 using ::testing::AtLeast; | 14 using ::testing::AtLeast; |
14 using ::testing::NotNull; | 15 using ::testing::NotNull; |
15 using ::testing::Return; | 16 using ::testing::Return; |
16 | 17 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 74 |
74 ACTION_P(AssignDirtyRect, rects) { | 75 ACTION_P(AssignDirtyRect, rects) { |
75 *arg0 = *rects; | 76 *arg0 = *rects; |
76 } | 77 } |
77 | 78 |
78 TEST_F(SessionManagerTest, OneRecordCycle) { | 79 TEST_F(SessionManagerTest, OneRecordCycle) { |
79 Init(); | 80 Init(); |
80 | 81 |
81 RectVector update_rects; | 82 RectVector update_rects; |
82 update_rects.push_back(gfx::Rect(0, 0, 10, 10)); | 83 update_rects.push_back(gfx::Rect(0, 0, 10, 10)); |
83 Capturer::DataPlanes planes; | 84 DataPlanes planes; |
84 for (int i = 0; i < Capturer::DataPlanes::kPlaneCount; ++i) { | 85 for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { |
85 planes.data[i] = reinterpret_cast<uint8*>(i); | 86 planes.data[i] = reinterpret_cast<uint8*>(i); |
86 planes.strides[i] = kWidth * 4; | 87 planes.strides[i] = kWidth * 4; |
87 } | 88 } |
88 scoped_refptr<Capturer::CaptureData> data(new Capturer::CaptureData(planes, | 89 scoped_refptr<CaptureData> data(new CaptureData(planes, kWidth, |
89 kWidth, | 90 kHeight, kFormat)); |
90 kHeight, | |
91 kFormat)); | |
92 // Set the recording rate to very low to avoid capture twice. | 91 // Set the recording rate to very low to avoid capture twice. |
93 record_->SetMaxRate(0.01); | 92 record_->SetMaxRate(0.01); |
94 | 93 |
95 // Add the mock client connection to the session. | 94 // Add the mock client connection to the session. |
96 EXPECT_CALL(*capturer_, width()).WillRepeatedly(Return(kWidth)); | 95 EXPECT_CALL(*capturer_, width()).WillRepeatedly(Return(kWidth)); |
97 EXPECT_CALL(*capturer_, height()).WillRepeatedly(Return(kHeight)); | 96 EXPECT_CALL(*capturer_, height()).WillRepeatedly(Return(kHeight)); |
98 EXPECT_CALL(*client_, SendInitClientMessage(kWidth, kHeight)); | 97 EXPECT_CALL(*client_, SendInitClientMessage(kWidth, kHeight)); |
99 record_->AddClient(client_); | 98 record_->AddClient(client_); |
100 | 99 |
101 // First the capturer is called. | 100 // First the capturer is called. |
(...skipping 20 matching lines...) Expand all Loading... |
122 | 121 |
123 // Make sure all tasks are completed. | 122 // Make sure all tasks are completed. |
124 message_loop_.RunAllPending(); | 123 message_loop_.RunAllPending(); |
125 } | 124 } |
126 | 125 |
127 // TODO(hclam): Add test for double buffering. | 126 // TODO(hclam): Add test for double buffering. |
128 // TODO(hclam): Add test for multiple captures. | 127 // TODO(hclam): Add test for multiple captures. |
129 // TODO(hclam): Add test for interruption. | 128 // TODO(hclam): Add test for interruption. |
130 | 129 |
131 } // namespace remoting | 130 } // namespace remoting |
OLD | NEW |