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

Side by Side Diff: remoting/test/app_remoting_latency_test_fixture.cc

Issue 1219923011: Added image pattern comparison logic for test interface and fixture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Minor update on comments" Created 5 years, 5 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/test/app_remoting_latency_test_fixture.h ('k') | remoting/test/test_video_renderer.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/test/app_remoting_latency_test_fixture.h" 5 #include "remoting/test/app_remoting_latency_test_fixture.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 FAIL(); 44 FAIL();
45 } 45 }
46 } 46 }
47 47
48 void AppRemotingLatencyTestFixture::TearDown() { 48 void AppRemotingLatencyTestFixture::TearDown() {
49 connection_helper_.reset(); 49 connection_helper_.reset();
50 } 50 }
51 51
52 void AppRemotingLatencyTestFixture::SetExpectedImagePattern( 52 void AppRemotingLatencyTestFixture::SetExpectedImagePattern(
53 const webrtc::DesktopRect& expected_rect, 53 const webrtc::DesktopRect& expected_rect,
54 const RgbaColor& expected_color) { 54 uint32_t expected_color) {
55 DCHECK(thread_checker_.CalledOnValidThread()); 55 DCHECK(thread_checker_.CalledOnValidThread());
56 DCHECK(!run_loop_ || !run_loop_->running()); 56 DCHECK(!run_loop_ || !run_loop_->running());
57 57
58 run_loop_.reset(new base::RunLoop()); 58 run_loop_.reset(new base::RunLoop());
59 base::ThreadTaskRunnerHandle::Get()->PostTask( 59 base::ThreadTaskRunnerHandle::Get()->PostTask(
60 FROM_HERE, 60 FROM_HERE, base::Bind(&TestVideoRenderer::ExpectAverageColorInRect,
61 base::Bind(&TestVideoRenderer::SetImagePatternAndMatchedCallback, 61 test_video_renderer_, expected_rect, expected_color,
62 test_video_renderer_, expected_rect, expected_color, 62 run_loop_->QuitClosure()));
63 run_loop_->QuitClosure()));
64 } 63 }
65 64
66 bool AppRemotingLatencyTestFixture::WaitForImagePatternMatched( 65 bool AppRemotingLatencyTestFixture::WaitForImagePatternMatched(
67 const base::TimeDelta& max_wait_time) { 66 const base::TimeDelta& max_wait_time) {
68 DCHECK(thread_checker_.CalledOnValidThread()); 67 DCHECK(thread_checker_.CalledOnValidThread());
69 DCHECK(run_loop_); 68 DCHECK(run_loop_);
70 69
71 DCHECK(!timer_->IsRunning()); 70 DCHECK(!timer_->IsRunning());
72 timer_->Start(FROM_HERE, max_wait_time, run_loop_->QuitClosure()); 71 timer_->Start(FROM_HERE, max_wait_time, run_loop_->QuitClosure());
73 72
74 run_loop_->Run(); 73 run_loop_->Run();
75 74
76 // Image pattern is matched if we stopped because of the reply not the timer. 75 // Image pattern is matched if we stopped because of the reply not the timer.
77 bool image_pattern_is_matched = (timer_->IsRunning()); 76 bool image_pattern_is_matched = (timer_->IsRunning());
78 timer_->Stop(); 77 timer_->Stop();
79 run_loop_.reset(); 78 run_loop_.reset();
80 79
81 return image_pattern_is_matched; 80 return image_pattern_is_matched;
82 } 81 }
83 82
84 } // namespace test 83 } // namespace test
85 } // namespace remoting 84 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/app_remoting_latency_test_fixture.h ('k') | remoting/test/test_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698