Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: remoting/host/video_frame_recorder_unittest.cc

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/video_frame_recorder.cc ('k') | remoting/host/win/launch_process_with_token.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/video_frame_recorder.h" 5 #include "remoting/host/video_frame_recorder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility>
11
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 14 #include "base/run_loop.h"
13 #include "base/stl_util.h" 15 #include "base/stl_util.h"
14 #include "remoting/codec/video_encoder_verbatim.h" 16 #include "remoting/codec/video_encoder_verbatim.h"
15 #include "remoting/proto/video.pb.h" 17 #include "remoting/proto/video.pb.h"
16 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
17 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
18 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 20 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
19 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" 21 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 118
117 // Tear down the recorder, if necessary. 119 // Tear down the recorder, if necessary.
118 recorder_.reset(); 120 recorder_.reset();
119 121
120 // Process any events resulting from recorder teardown. 122 // Process any events resulting from recorder teardown.
121 base::RunLoop().RunUntilIdle(); 123 base::RunLoop().RunUntilIdle();
122 } 124 }
123 125
124 void VideoFrameRecorderTest::CreateAndWrapEncoder() { 126 void VideoFrameRecorderTest::CreateAndWrapEncoder() {
125 scoped_ptr<VideoEncoder> encoder(new VideoEncoderVerbatim()); 127 scoped_ptr<VideoEncoder> encoder(new VideoEncoderVerbatim());
126 encoder_ = recorder_->WrapVideoEncoder(encoder.Pass()); 128 encoder_ = recorder_->WrapVideoEncoder(std::move(encoder));
127 129
128 // Encode a dummy frame to bind the wrapper to the TaskRunner. 130 // Encode a dummy frame to bind the wrapper to the TaskRunner.
129 EncodeDummyFrame(); 131 EncodeDummyFrame();
130 } 132 }
131 133
132 scoped_ptr<webrtc::DesktopFrame> VideoFrameRecorderTest::CreateNextFrame() { 134 scoped_ptr<webrtc::DesktopFrame> VideoFrameRecorderTest::CreateNextFrame() {
133 scoped_ptr<webrtc::DesktopFrame> frame( 135 scoped_ptr<webrtc::DesktopFrame> frame(new webrtc::BasicDesktopFrame(
134 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kFrameWidth, 136 webrtc::DesktopSize(kFrameWidth, kFrameHeight)));
135 kFrameHeight)));
136 137
137 // Fill content, DPI and updated-region based on |frame_count_| so that each 138 // Fill content, DPI and updated-region based on |frame_count_| so that each
138 // generated frame is different. 139 // generated frame is different.
139 ++frame_count_; 140 ++frame_count_;
140 memset(frame->data(), frame_count_, frame->stride() * kFrameHeight); 141 memset(frame->data(), frame_count_, frame->stride() * kFrameHeight);
141 frame->set_dpi(webrtc::DesktopVector(frame_count_, frame_count_)); 142 frame->set_dpi(webrtc::DesktopVector(frame_count_, frame_count_));
142 frame->mutable_updated_region()->SetRect( 143 frame->mutable_updated_region()->SetRect(
143 webrtc::DesktopRect::MakeWH(frame_count_, frame_count_)); 144 webrtc::DesktopRect::MakeWH(frame_count_, frame_count_));
144 145
145 return frame.Pass(); 146 return frame;
146 } 147 }
147 148
148 void VideoFrameRecorderTest::CreateTestFrames() { 149 void VideoFrameRecorderTest::CreateTestFrames() {
149 for (size_t i = 0; i < kTestFrameCount; ++i) { 150 for (size_t i = 0; i < kTestFrameCount; ++i) {
150 test_frames_.push_back(CreateNextFrame().release()); 151 test_frames_.push_back(CreateNextFrame().release());
151 } 152 }
152 } 153 }
153 154
154 void VideoFrameRecorderTest::EncodeTestFrames() { 155 void VideoFrameRecorderTest::EncodeTestFrames() {
155 for (DesktopFrames::iterator i = test_frames_.begin(); 156 for (DesktopFrames::iterator i = test_frames_.begin();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 EncodeTestFrames(); 310 EncodeTestFrames();
310 311
311 // Clear the list of expected test frames, since none should be recorded. 312 // Clear the list of expected test frames, since none should be recorded.
312 STLDeleteElements(&test_frames_); 313 STLDeleteElements(&test_frames_);
313 314
314 // Verify that the recorded frames match the ones passed to the encoder. 315 // Verify that the recorded frames match the ones passed to the encoder.
315 VerifyTestFrames(); 316 VerifyTestFrames();
316 } 317 }
317 318
318 } // namespace remoting 319 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/video_frame_recorder.cc ('k') | remoting/host/win/launch_process_with_token.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698