OLD | NEW |
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/test/test_video_renderer.h" | 5 #include "remoting/test/test_video_renderer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
17 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
18 #include "remoting/codec/video_encoder.h" | 19 #include "remoting/codec/video_encoder.h" |
19 #include "remoting/codec/video_encoder_verbatim.h" | 20 #include "remoting/codec/video_encoder_verbatim.h" |
20 #include "remoting/codec/video_encoder_vpx.h" | 21 #include "remoting/codec/video_encoder_vpx.h" |
21 #include "remoting/proto/video.pb.h" | 22 #include "remoting/proto/video.pb.h" |
22 #include "remoting/test/rgb_value.h" | 23 #include "remoting/test/rgb_value.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 double error_limit); | 60 double error_limit); |
60 | 61 |
61 // Handles setting an image pattern and sending a frame to TestVideoRenderer. | 62 // Handles setting an image pattern and sending a frame to TestVideoRenderer. |
62 // |expect_to_match| indicates if the image pattern is expected to match. | 63 // |expect_to_match| indicates if the image pattern is expected to match. |
63 void TestImagePatternMatch(int screen_width, | 64 void TestImagePatternMatch(int screen_width, |
64 int screen_height, | 65 int screen_height, |
65 const webrtc::DesktopRect& expected_rect, | 66 const webrtc::DesktopRect& expected_rect, |
66 bool expect_to_match); | 67 bool expect_to_match); |
67 | 68 |
68 // Generate a basic desktop frame containing a gradient. | 69 // Generate a basic desktop frame containing a gradient. |
69 scoped_ptr<webrtc::DesktopFrame> CreateDesktopFrameWithGradient( | 70 std::unique_ptr<webrtc::DesktopFrame> CreateDesktopFrameWithGradient( |
70 int screen_width, int screen_height) const; | 71 int screen_width, |
| 72 int screen_height) const; |
71 | 73 |
72 protected: | 74 protected: |
73 // Used to post tasks to the message loop. | 75 // Used to post tasks to the message loop. |
74 scoped_ptr<base::RunLoop> run_loop_; | 76 std::unique_ptr<base::RunLoop> run_loop_; |
75 | 77 |
76 // Used to set timeouts and delays. | 78 // Used to set timeouts and delays. |
77 scoped_ptr<base::Timer> timer_; | 79 std::unique_ptr<base::Timer> timer_; |
78 | 80 |
79 // Manages the decoder and process generated video packets. | 81 // Manages the decoder and process generated video packets. |
80 scoped_ptr<TestVideoRenderer> test_video_renderer_; | 82 std::unique_ptr<TestVideoRenderer> test_video_renderer_; |
81 | 83 |
82 // Used to encode desktop frames to generate video packets. | 84 // Used to encode desktop frames to generate video packets. |
83 scoped_ptr<VideoEncoder> encoder_; | 85 std::unique_ptr<VideoEncoder> encoder_; |
84 | 86 |
85 private: | 87 private: |
86 // testing::Test interface. | 88 // testing::Test interface. |
87 void SetUp() override; | 89 void SetUp() override; |
88 | 90 |
89 // Set image pattern, send video packet and returns if the expected pattern is | 91 // Set image pattern, send video packet and returns if the expected pattern is |
90 // matched. | 92 // matched. |
91 bool SendPacketAndWaitForMatch(scoped_ptr<VideoPacket> packet, | 93 bool SendPacketAndWaitForMatch(std::unique_ptr<VideoPacket> packet, |
92 const webrtc::DesktopRect& expected_rect, | 94 const webrtc::DesktopRect& expected_rect, |
93 const RGBValue& expected_average_color); | 95 const RGBValue& expected_average_color); |
94 | 96 |
95 // Returns the average color value of pixels fall within |rect|. | 97 // Returns the average color value of pixels fall within |rect|. |
96 // NOTE: Callers should not release the objects. | 98 // NOTE: Callers should not release the objects. |
97 RGBValue CalculateAverageColorValueForFrame( | 99 RGBValue CalculateAverageColorValueForFrame( |
98 const webrtc::DesktopFrame* frame, | 100 const webrtc::DesktopFrame* frame, |
99 const webrtc::DesktopRect& rect) const; | 101 const webrtc::DesktopRect& rect) const; |
100 | 102 |
101 // Return the mean error of two frames over all pixels, where error at each | 103 // Return the mean error of two frames over all pixels, where error at each |
102 // pixel is the root mean square of the errors in the R, G and B components, | 104 // pixel is the root mean square of the errors in the R, G and B components, |
103 // each normalized to [0, 1]. | 105 // each normalized to [0, 1]. |
104 double CalculateError(const webrtc::DesktopFrame* original_frame, | 106 double CalculateError(const webrtc::DesktopFrame* original_frame, |
105 const webrtc::DesktopFrame* decoded_frame) const; | 107 const webrtc::DesktopFrame* decoded_frame) const; |
106 | 108 |
107 // Fill a desktop frame with a gradient. | 109 // Fill a desktop frame with a gradient. |
108 void FillFrameWithGradient(webrtc::DesktopFrame* frame) const; | 110 void FillFrameWithGradient(webrtc::DesktopFrame* frame) const; |
109 | 111 |
110 // The thread's message loop. Valid only when the thread is alive. | 112 // The thread's message loop. Valid only when the thread is alive. |
111 scoped_ptr<base::MessageLoop> message_loop_; | 113 std::unique_ptr<base::MessageLoop> message_loop_; |
112 | 114 |
113 DISALLOW_COPY_AND_ASSIGN(TestVideoRendererTest); | 115 DISALLOW_COPY_AND_ASSIGN(TestVideoRendererTest); |
114 }; | 116 }; |
115 | 117 |
116 TestVideoRendererTest::TestVideoRendererTest() | 118 TestVideoRendererTest::TestVideoRendererTest() |
117 : timer_(new base::Timer(true, false)) {} | 119 : timer_(new base::Timer(true, false)) {} |
118 | 120 |
119 TestVideoRendererTest::~TestVideoRendererTest() {} | 121 TestVideoRendererTest::~TestVideoRendererTest() {} |
120 | 122 |
121 void TestVideoRendererTest::SetUp() { | 123 void TestVideoRendererTest::SetUp() { |
122 if (!base::MessageLoop::current()) { | 124 if (!base::MessageLoop::current()) { |
123 // Create a temporary message loop if the current thread does not already | 125 // Create a temporary message loop if the current thread does not already |
124 // have one. | 126 // have one. |
125 message_loop_.reset(new base::MessageLoop); | 127 message_loop_.reset(new base::MessageLoop); |
126 } | 128 } |
127 test_video_renderer_.reset(new TestVideoRenderer()); | 129 test_video_renderer_.reset(new TestVideoRenderer()); |
128 } | 130 } |
129 | 131 |
130 void TestVideoRendererTest::TestVideoPacketProcessing(int screen_width, | 132 void TestVideoRendererTest::TestVideoPacketProcessing(int screen_width, |
131 int screen_height, | 133 int screen_height, |
132 double error_limit) { | 134 double error_limit) { |
133 DCHECK(encoder_); | 135 DCHECK(encoder_); |
134 DCHECK(test_video_renderer_); | 136 DCHECK(test_video_renderer_); |
135 | 137 |
136 // Generate a frame containing a gradient. | 138 // Generate a frame containing a gradient. |
137 scoped_ptr<webrtc::DesktopFrame> original_frame = | 139 std::unique_ptr<webrtc::DesktopFrame> original_frame = |
138 CreateDesktopFrameWithGradient(screen_width, screen_height); | 140 CreateDesktopFrameWithGradient(screen_width, screen_height); |
139 EXPECT_TRUE(original_frame); | 141 EXPECT_TRUE(original_frame); |
140 | 142 |
141 scoped_ptr<VideoPacket> packet = encoder_->Encode(*original_frame.get()); | 143 std::unique_ptr<VideoPacket> packet = encoder_->Encode(*original_frame.get()); |
142 | 144 |
143 DCHECK(!run_loop_ || !run_loop_->running()); | 145 DCHECK(!run_loop_ || !run_loop_->running()); |
144 DCHECK(!timer_->IsRunning()); | 146 DCHECK(!timer_->IsRunning()); |
145 run_loop_.reset(new base::RunLoop()); | 147 run_loop_.reset(new base::RunLoop()); |
146 | 148 |
147 // Set an extremely long time: 10 min to prevent bugs from hanging the system. | 149 // Set an extremely long time: 10 min to prevent bugs from hanging the system. |
148 // NOTE: We've seen cases which take up to 1 min to process a packet, so an | 150 // NOTE: We've seen cases which take up to 1 min to process a packet, so an |
149 // extremely long time as 10 min is chosen to avoid being variable/flaky. | 151 // extremely long time as 10 min is chosen to avoid being variable/flaky. |
150 timer_->Start(FROM_HERE, base::TimeDelta::FromMinutes(10), | 152 timer_->Start(FROM_HERE, base::TimeDelta::FromMinutes(10), |
151 run_loop_->QuitClosure()); | 153 run_loop_->QuitClosure()); |
152 | 154 |
153 // Wait for the video packet to be processed and rendered to buffer. | 155 // Wait for the video packet to be processed and rendered to buffer. |
154 test_video_renderer_->ProcessVideoPacket(std::move(packet), | 156 test_video_renderer_->ProcessVideoPacket(std::move(packet), |
155 run_loop_->QuitClosure()); | 157 run_loop_->QuitClosure()); |
156 | 158 |
157 run_loop_->Run(); | 159 run_loop_->Run(); |
158 EXPECT_TRUE(timer_->IsRunning()); | 160 EXPECT_TRUE(timer_->IsRunning()); |
159 timer_->Stop(); | 161 timer_->Stop(); |
160 run_loop_.reset(); | 162 run_loop_.reset(); |
161 | 163 |
162 scoped_ptr<webrtc::DesktopFrame> buffer_copy = | 164 std::unique_ptr<webrtc::DesktopFrame> buffer_copy = |
163 test_video_renderer_->GetCurrentFrameForTest(); | 165 test_video_renderer_->GetCurrentFrameForTest(); |
164 EXPECT_NE(buffer_copy, nullptr); | 166 EXPECT_NE(buffer_copy, nullptr); |
165 | 167 |
166 // The original frame is compared to the decoded video frame to check that | 168 // The original frame is compared to the decoded video frame to check that |
167 // the mean error over all pixels does not exceed a given limit. | 169 // the mean error over all pixels does not exceed a given limit. |
168 double error = CalculateError(original_frame.get(), buffer_copy.get()); | 170 double error = CalculateError(original_frame.get(), buffer_copy.get()); |
169 EXPECT_LT(error, error_limit); | 171 EXPECT_LT(error, error_limit); |
170 } | 172 } |
171 | 173 |
172 bool TestVideoRendererTest::SendPacketAndWaitForMatch( | 174 bool TestVideoRendererTest::SendPacketAndWaitForMatch( |
173 scoped_ptr<VideoPacket> packet, | 175 std::unique_ptr<VideoPacket> packet, |
174 const webrtc::DesktopRect& expected_rect, | 176 const webrtc::DesktopRect& expected_rect, |
175 const RGBValue& expected_average_color) { | 177 const RGBValue& expected_average_color) { |
176 DCHECK(!run_loop_ || !run_loop_->running()); | 178 DCHECK(!run_loop_ || !run_loop_->running()); |
177 DCHECK(!timer_->IsRunning()); | 179 DCHECK(!timer_->IsRunning()); |
178 run_loop_.reset(new base::RunLoop()); | 180 run_loop_.reset(new base::RunLoop()); |
179 | 181 |
180 // Set an extremely long time: 10 min to prevent bugs from hanging the system. | 182 // Set an extremely long time: 10 min to prevent bugs from hanging the system. |
181 // NOTE: We've seen cases which take up to 1 min to process a packet, so an | 183 // NOTE: We've seen cases which take up to 1 min to process a packet, so an |
182 // extremely long time as 10 min is chosen to avoid being variable/flaky. | 184 // extremely long time as 10 min is chosen to avoid being variable/flaky. |
183 timer_->Start(FROM_HERE, base::TimeDelta::FromMinutes(10), | 185 timer_->Start(FROM_HERE, base::TimeDelta::FromMinutes(10), |
184 run_loop_->QuitClosure()); | 186 run_loop_->QuitClosure()); |
185 | 187 |
186 // Set expected image pattern. | 188 // Set expected image pattern. |
187 test_video_renderer_->ExpectAverageColorInRect( | 189 test_video_renderer_->ExpectAverageColorInRect( |
188 expected_rect, expected_average_color, run_loop_->QuitClosure()); | 190 expected_rect, expected_average_color, run_loop_->QuitClosure()); |
189 | 191 |
190 // Used to verify if the expected image pattern will be matched by |packet|. | 192 // Used to verify if the expected image pattern will be matched by |packet|. |
191 scoped_ptr<VideoPacket> packet_copy(new VideoPacket(*packet.get())); | 193 std::unique_ptr<VideoPacket> packet_copy(new VideoPacket(*packet.get())); |
192 | 194 |
193 // Post first test packet: |packet|. | 195 // Post first test packet: |packet|. |
194 test_video_renderer_->ProcessVideoPacket(std::move(packet), | 196 test_video_renderer_->ProcessVideoPacket(std::move(packet), |
195 base::Bind(&base::DoNothing)); | 197 base::Bind(&base::DoNothing)); |
196 | 198 |
197 // Second packet: |packet_copy| is posted, and |second_packet_done_callback| | 199 // Second packet: |packet_copy| is posted, and |second_packet_done_callback| |
198 // will always be posted back to main thread, however, whether it will be | 200 // will always be posted back to main thread, however, whether it will be |
199 // called depends on whether the expected pattern is matched or not. | 201 // called depends on whether the expected pattern is matched or not. |
200 bool second_packet_done_is_called = false; | 202 bool second_packet_done_is_called = false; |
201 base::Closure second_packet_done_callback = | 203 base::Closure second_packet_done_callback = |
(...skipping 17 matching lines...) Expand all Loading... |
219 } | 221 } |
220 | 222 |
221 void TestVideoRendererTest::TestImagePatternMatch( | 223 void TestVideoRendererTest::TestImagePatternMatch( |
222 int screen_width, | 224 int screen_width, |
223 int screen_height, | 225 int screen_height, |
224 const webrtc::DesktopRect& expected_rect, | 226 const webrtc::DesktopRect& expected_rect, |
225 bool expect_to_match) { | 227 bool expect_to_match) { |
226 DCHECK(encoder_); | 228 DCHECK(encoder_); |
227 DCHECK(test_video_renderer_); | 229 DCHECK(test_video_renderer_); |
228 | 230 |
229 scoped_ptr<webrtc::DesktopFrame> frame = | 231 std::unique_ptr<webrtc::DesktopFrame> frame = |
230 CreateDesktopFrameWithGradient(screen_width, screen_height); | 232 CreateDesktopFrameWithGradient(screen_width, screen_height); |
231 RGBValue expected_average_color = | 233 RGBValue expected_average_color = |
232 CalculateAverageColorValueForFrame(frame.get(), expected_rect); | 234 CalculateAverageColorValueForFrame(frame.get(), expected_rect); |
233 scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame.get()); | 235 std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame.get()); |
234 | 236 |
235 if (expect_to_match) { | 237 if (expect_to_match) { |
236 EXPECT_TRUE(SendPacketAndWaitForMatch(std::move(packet), expected_rect, | 238 EXPECT_TRUE(SendPacketAndWaitForMatch(std::move(packet), expected_rect, |
237 expected_average_color)); | 239 expected_average_color)); |
238 } else { | 240 } else { |
239 // Shift each channel by 128. | 241 // Shift each channel by 128. |
240 // e.g. (10, 127, 200) -> (138, 255, 73). | 242 // e.g. (10, 127, 200) -> (138, 255, 73). |
241 // In this way, the error between expected color and true value is always | 243 // In this way, the error between expected color and true value is always |
242 // around 0.5. | 244 // around 0.5. |
243 int red_shift = (expected_average_color.red + 128) % 255; | 245 int red_shift = (expected_average_color.red + 128) % 255; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 327 |
326 // Normalize the error to [0, 1]. | 328 // Normalize the error to [0, 1]. |
327 error /= 255.0; | 329 error /= 255.0; |
328 error_sum_squares += error * error; | 330 error_sum_squares += error * error; |
329 } | 331 } |
330 } | 332 } |
331 } | 333 } |
332 return sqrt(error_sum_squares / (3 * screen_width * screen_height)); | 334 return sqrt(error_sum_squares / (3 * screen_width * screen_height)); |
333 } | 335 } |
334 | 336 |
335 scoped_ptr<webrtc::DesktopFrame> | 337 std::unique_ptr<webrtc::DesktopFrame> |
336 TestVideoRendererTest::CreateDesktopFrameWithGradient( | 338 TestVideoRendererTest::CreateDesktopFrameWithGradient(int screen_width, |
337 int screen_width, int screen_height) const { | 339 int screen_height) const { |
338 webrtc::DesktopSize screen_size(screen_width, screen_height); | 340 webrtc::DesktopSize screen_size(screen_width, screen_height); |
339 scoped_ptr<webrtc::DesktopFrame> frame( | 341 std::unique_ptr<webrtc::DesktopFrame> frame( |
340 new webrtc::BasicDesktopFrame(screen_size)); | 342 new webrtc::BasicDesktopFrame(screen_size)); |
341 frame->mutable_updated_region()->SetRect( | 343 frame->mutable_updated_region()->SetRect( |
342 webrtc::DesktopRect::MakeSize(screen_size)); | 344 webrtc::DesktopRect::MakeSize(screen_size)); |
343 FillFrameWithGradient(frame.get()); | 345 FillFrameWithGradient(frame.get()); |
344 return frame; | 346 return frame; |
345 } | 347 } |
346 | 348 |
347 void TestVideoRendererTest::FillFrameWithGradient( | 349 void TestVideoRendererTest::FillFrameWithGradient( |
348 webrtc::DesktopFrame* frame) const { | 350 webrtc::DesktopFrame* frame) const { |
349 for (int y = 0; y < frame->size().height(); ++y) { | 351 for (int y = 0; y < frame->size().height(); ++y) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 test_video_renderer_->SetCodecForDecoding( | 394 test_video_renderer_->SetCodecForDecoding( |
393 protocol::ChannelConfig::CODEC_VP8); | 395 protocol::ChannelConfig::CODEC_VP8); |
394 | 396 |
395 // Post multiple tasks to |test_video_renderer_|, and it should not crash. | 397 // Post multiple tasks to |test_video_renderer_|, and it should not crash. |
396 // 20 is chosen because it's large enough to make sure that there will be | 398 // 20 is chosen because it's large enough to make sure that there will be |
397 // more than one task on the video decode thread, while not too large to wait | 399 // more than one task on the video decode thread, while not too large to wait |
398 // for too long for the unit test to complete. | 400 // for too long for the unit test to complete. |
399 const int task_num = 20; | 401 const int task_num = 20; |
400 ScopedVector<VideoPacket> video_packets; | 402 ScopedVector<VideoPacket> video_packets; |
401 for (int i = 0; i < task_num; ++i) { | 403 for (int i = 0; i < task_num; ++i) { |
402 scoped_ptr<webrtc::DesktopFrame> original_frame = | 404 std::unique_ptr<webrtc::DesktopFrame> original_frame = |
403 CreateDesktopFrameWithGradient(kDefaultScreenWidthPx, | 405 CreateDesktopFrameWithGradient(kDefaultScreenWidthPx, |
404 kDefaultScreenHeightPx); | 406 kDefaultScreenHeightPx); |
405 video_packets.push_back(encoder_->Encode(*original_frame.get())); | 407 video_packets.push_back(encoder_->Encode(*original_frame.get())); |
406 } | 408 } |
407 | 409 |
408 for (int i = 0; i < task_num; ++i) { | 410 for (int i = 0; i < task_num; ++i) { |
409 // Transfer ownership of video packet. | 411 // Transfer ownership of video packet. |
410 VideoPacket* packet = video_packets[i]; | 412 VideoPacket* packet = video_packets[i]; |
411 video_packets[i] = nullptr; | 413 video_packets[i] = nullptr; |
412 test_video_renderer_->ProcessVideoPacket(make_scoped_ptr(packet), | 414 test_video_renderer_->ProcessVideoPacket(base::WrapUnique(packet), |
413 base::Bind(&base::DoNothing)); | 415 base::Bind(&base::DoNothing)); |
414 } | 416 } |
415 } | 417 } |
416 | 418 |
417 // Verify video packet size change is handled properly. | 419 // Verify video packet size change is handled properly. |
418 TEST_F(TestVideoRendererTest, VerifyVideoPacketSizeChange) { | 420 TEST_F(TestVideoRendererTest, VerifyVideoPacketSizeChange) { |
419 encoder_ = VideoEncoderVpx::CreateForVP8(); | 421 encoder_ = VideoEncoderVpx::CreateForVP8(); |
420 test_video_renderer_->SetCodecForDecoding( | 422 test_video_renderer_->SetCodecForDecoding( |
421 protocol::ChannelConfig::Codec::CODEC_VP8); | 423 protocol::ChannelConfig::Codec::CODEC_VP8); |
422 | 424 |
423 TestVideoPacketProcessing(kDefaultScreenWidthPx, kDefaultScreenHeightPx, | 425 TestVideoPacketProcessing(kDefaultScreenWidthPx, kDefaultScreenHeightPx, |
424 kDefaultErrorLimit); | 426 kDefaultErrorLimit); |
425 | 427 |
426 TestVideoPacketProcessing(2 * kDefaultScreenWidthPx, | 428 TestVideoPacketProcessing(2 * kDefaultScreenWidthPx, |
427 2 * kDefaultScreenHeightPx, kDefaultErrorLimit); | 429 2 * kDefaultScreenHeightPx, kDefaultErrorLimit); |
428 | 430 |
429 TestVideoPacketProcessing(kDefaultScreenWidthPx / 2, | 431 TestVideoPacketProcessing(kDefaultScreenWidthPx / 2, |
430 kDefaultScreenHeightPx / 2, kDefaultErrorLimit); | 432 kDefaultScreenHeightPx / 2, kDefaultErrorLimit); |
431 } | 433 } |
432 | 434 |
433 // Verify setting expected image pattern doesn't break video packet processing. | 435 // Verify setting expected image pattern doesn't break video packet processing. |
434 TEST_F(TestVideoRendererTest, VerifySetExpectedImagePattern) { | 436 TEST_F(TestVideoRendererTest, VerifySetExpectedImagePattern) { |
435 encoder_ = VideoEncoderVpx::CreateForVP8(); | 437 encoder_ = VideoEncoderVpx::CreateForVP8(); |
436 test_video_renderer_->SetCodecForDecoding( | 438 test_video_renderer_->SetCodecForDecoding( |
437 protocol::ChannelConfig::Codec::CODEC_VP8); | 439 protocol::ChannelConfig::Codec::CODEC_VP8); |
438 | 440 |
439 DCHECK(encoder_); | 441 DCHECK(encoder_); |
440 DCHECK(test_video_renderer_); | 442 DCHECK(test_video_renderer_); |
441 | 443 |
442 scoped_ptr<webrtc::DesktopFrame> frame = CreateDesktopFrameWithGradient( | 444 std::unique_ptr<webrtc::DesktopFrame> frame = CreateDesktopFrameWithGradient( |
443 kDefaultScreenWidthPx, kDefaultScreenHeightPx); | 445 kDefaultScreenWidthPx, kDefaultScreenHeightPx); |
444 | 446 |
445 // Since we don't care whether expected image pattern is matched or not in | 447 // Since we don't care whether expected image pattern is matched or not in |
446 // this case, an expected color is chosen arbitrarily. | 448 // this case, an expected color is chosen arbitrarily. |
447 RGBValue black_color = RGBValue(); | 449 RGBValue black_color = RGBValue(); |
448 | 450 |
449 // Set expected image pattern. | 451 // Set expected image pattern. |
450 test_video_renderer_->ExpectAverageColorInRect( | 452 test_video_renderer_->ExpectAverageColorInRect( |
451 kDefaultExpectedRect, black_color, base::Bind(&base::DoNothing)); | 453 kDefaultExpectedRect, black_color, base::Bind(&base::DoNothing)); |
452 | 454 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 TEST_F(TestVideoRendererTest, VerifyImagePatternNotMatchForVERBATIM) { | 506 TEST_F(TestVideoRendererTest, VerifyImagePatternNotMatchForVERBATIM) { |
505 encoder_.reset(new VideoEncoderVerbatim()); | 507 encoder_.reset(new VideoEncoderVerbatim()); |
506 test_video_renderer_->SetCodecForDecoding( | 508 test_video_renderer_->SetCodecForDecoding( |
507 protocol::ChannelConfig::Codec::CODEC_VERBATIM); | 509 protocol::ChannelConfig::Codec::CODEC_VERBATIM); |
508 TestImagePatternMatch(kDefaultScreenWidthPx, kDefaultScreenHeightPx, | 510 TestImagePatternMatch(kDefaultScreenWidthPx, kDefaultScreenHeightPx, |
509 kDefaultExpectedRect, false); | 511 kDefaultExpectedRect, false); |
510 } | 512 } |
511 | 513 |
512 } // namespace test | 514 } // namespace test |
513 } // namespace remoting | 515 } // namespace remoting |
OLD | NEW |