| OLD | NEW |
| 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/host/screen_recorder.h" | 5 #include "remoting/host/screen_recorder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "remoting/base/base_mock_objects.h" | 9 #include "remoting/base/base_mock_objects.h" |
| 10 #include "remoting/host/host_mock_objects.h" | 10 #include "remoting/host/host_mock_objects.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // ScreenRecorder is instructed to come to a complete stop. We expect the stop | 121 // ScreenRecorder is instructed to come to a complete stop. We expect the stop |
| 122 // sequence to be executed successfully. | 122 // sequence to be executed successfully. |
| 123 TEST_F(ScreenRecorderTest, StartAndStop) { | 123 TEST_F(ScreenRecorderTest, StartAndStop) { |
| 124 SkRegion update_region(SkIRect::MakeXYWH(0, 0, 10, 10)); | 124 SkRegion update_region(SkIRect::MakeXYWH(0, 0, 10, 10)); |
| 125 DataPlanes planes; | 125 DataPlanes planes; |
| 126 for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { | 126 for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { |
| 127 planes.data[i] = reinterpret_cast<uint8*>(i); | 127 planes.data[i] = reinterpret_cast<uint8*>(i); |
| 128 planes.strides[i] = kWidth * 4; | 128 planes.strides[i] = kWidth * 4; |
| 129 } | 129 } |
| 130 | 130 |
| 131 Expectation capturer_start = EXPECT_CALL(capturer_, Start()); | 131 Expectation capturer_start = EXPECT_CALL(capturer_, Start(_)); |
| 132 | 132 |
| 133 SkISize size(SkISize::Make(kWidth, kHeight)); | 133 SkISize size(SkISize::Make(kWidth, kHeight)); |
| 134 scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat)); | 134 scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat)); |
| 135 EXPECT_CALL(capturer_, InvalidateFullScreen()); | 135 EXPECT_CALL(capturer_, InvalidateFullScreen()); |
| 136 | 136 |
| 137 // First the capturer is called. | 137 // First the capturer is called. |
| 138 Expectation capturer_capture = EXPECT_CALL(capturer_, CaptureInvalidRegion(_)) | 138 Expectation capturer_capture = EXPECT_CALL(capturer_, CaptureInvalidRegion(_)) |
| 139 .After(capturer_start) | 139 .After(capturer_start) |
| 140 .WillRepeatedly(RunCallback(update_region, data)); | 140 .WillRepeatedly(RunCallback(update_region, data)); |
| 141 | 141 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 171 message_loop_.Run(); | 171 message_loop_.Run(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 TEST_F(ScreenRecorderTest, StopWithoutStart) { | 174 TEST_F(ScreenRecorderTest, StopWithoutStart) { |
| 175 EXPECT_CALL(capturer_, Stop()); | 175 EXPECT_CALL(capturer_, Stop()); |
| 176 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); | 176 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); |
| 177 message_loop_.Run(); | 177 message_loop_.Run(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace remoting | 180 } // namespace remoting |
| OLD | NEW |