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

Side by Side Diff: remoting/client/software_video_renderer_unittest.cc

Issue 2627433003: Remove ScopedVector from remoting/. (Closed)
Patch Set: rev Created 3 years, 11 months 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/client/plugin/pepper_video_renderer_2d.cc ('k') | remoting/host/chromoting_host.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/client/software_video_renderer.h" 5 #include "remoting/client/software_video_renderer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
9 #include <utility> 10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/bind.h" 13 #include "base/bind.h"
13 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
14 #include "base/memory/scoped_vector.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "remoting/client/client_context.h" 18 #include "remoting/client/client_context.h"
19 #include "remoting/codec/video_encoder_verbatim.h" 19 #include "remoting/codec/video_encoder_verbatim.h"
20 #include "remoting/proto/video.pb.h" 20 #include "remoting/proto/video.pb.h"
21 #include "remoting/protocol/frame_consumer.h" 21 #include "remoting/protocol/frame_consumer.h"
22 #include "remoting/protocol/session_config.h" 22 #include "remoting/protocol/session_config.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 24 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 TestFrameConsumer frame_consumer_; 150 TestFrameConsumer frame_consumer_;
151 std::unique_ptr<SoftwareVideoRenderer> renderer_; 151 std::unique_ptr<SoftwareVideoRenderer> renderer_;
152 152
153 VideoEncoderVerbatim encoder_; 153 VideoEncoderVerbatim encoder_;
154 }; 154 };
155 155
156 TEST_F(SoftwareVideoRendererTest, DecodeFrame) { 156 TEST_F(SoftwareVideoRendererTest, DecodeFrame) {
157 const int kFrameCount = 5; 157 const int kFrameCount = 5;
158 158
159 ScopedVector<DesktopFrame> test_frames; 159 std::vector<std::unique_ptr<DesktopFrame>> test_frames;
160 160
161 // std::vector<bool> doesn't allow to get pointer to individual values, so 161 // std::vector<bool> doesn't allow to get pointer to individual values, so
162 // int needs to be used instead. 162 // int needs to be used instead.
163 std::vector<int> callback_called(kFrameCount); 163 std::vector<int> callback_called(kFrameCount);
164 164
165 for (int frame_index = 0; frame_index < kFrameCount; frame_index++) { 165 for (int frame_index = 0; frame_index < kFrameCount; frame_index++) {
166 test_frames.push_back(CreateTestFrame(frame_index)); 166 test_frames.push_back(CreateTestFrame(frame_index));
167 callback_called[frame_index] = 0; 167 callback_called[frame_index] = 0;
168 168
169 renderer_->ProcessVideoPacket( 169 renderer_->ProcessVideoPacket(
170 encoder_.Encode(*test_frames[frame_index]), 170 encoder_.Encode(*test_frames[frame_index]),
171 base::Bind(&SetTrue, &(callback_called[frame_index]))); 171 base::Bind(&SetTrue, &(callback_called[frame_index])));
172 } 172 }
173 173
174 for (int frame_index = 0; frame_index < kFrameCount; frame_index++) { 174 for (int frame_index = 0; frame_index < kFrameCount; frame_index++) {
175 base::Closure done_callback; 175 base::Closure done_callback;
176 std::unique_ptr<DesktopFrame> decoded_frame = 176 std::unique_ptr<DesktopFrame> decoded_frame =
177 frame_consumer_.WaitForNextFrame(&done_callback); 177 frame_consumer_.WaitForNextFrame(&done_callback);
178 178
179 EXPECT_FALSE(callback_called[frame_index]); 179 EXPECT_FALSE(callback_called[frame_index]);
180 done_callback.Run(); 180 done_callback.Run();
181 EXPECT_TRUE(callback_called[frame_index]); 181 EXPECT_TRUE(callback_called[frame_index]);
182 182
183 EXPECT_TRUE(CompareFrames(*test_frames[frame_index], *decoded_frame)); 183 EXPECT_TRUE(CompareFrames(*test_frames[frame_index], *decoded_frame));
184 } 184 }
185 } 185 }
186 186
187 } // namespace remoting 187 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_video_renderer_2d.cc ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698