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

Side by Side Diff: media/base/test_helpers.cc

Issue 2021273002: Extending timeout for AudioRendererSinkCacheTest.SmokeTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding forgotten const Created 4 years, 6 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 | « media/base/test_helpers.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/base/test_helpers.h" 5 #include "media/base/test_helpers.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return base::Bind(&MockCallback::RunWithBool, callback); 57 return base::Bind(&MockCallback::RunWithBool, callback);
58 } 58 }
59 59
60 PipelineStatusCB NewExpectedStatusCB(PipelineStatus status) { 60 PipelineStatusCB NewExpectedStatusCB(PipelineStatus status) {
61 StrictMock<MockCallback>* callback = new StrictMock<MockCallback>(); 61 StrictMock<MockCallback>* callback = new StrictMock<MockCallback>();
62 EXPECT_CALL(*callback, RunWithStatus(status)); 62 EXPECT_CALL(*callback, RunWithStatus(status));
63 return base::Bind(&MockCallback::RunWithStatus, callback); 63 return base::Bind(&MockCallback::RunWithStatus, callback);
64 } 64 }
65 65
66 WaitableMessageLoopEvent::WaitableMessageLoopEvent() 66 WaitableMessageLoopEvent::WaitableMessageLoopEvent()
67 : WaitableMessageLoopEvent(TestTimeouts::action_timeout()) {}
68
69 WaitableMessageLoopEvent::WaitableMessageLoopEvent(base::TimeDelta timeout)
67 : message_loop_(base::MessageLoop::current()), 70 : message_loop_(base::MessageLoop::current()),
68 signaled_(false), 71 signaled_(false),
69 status_(PIPELINE_OK) { 72 status_(PIPELINE_OK),
73 timeout_(timeout) {
70 DCHECK(message_loop_); 74 DCHECK(message_loop_);
71 } 75 }
72 76
73 WaitableMessageLoopEvent::~WaitableMessageLoopEvent() {} 77 WaitableMessageLoopEvent::~WaitableMessageLoopEvent() {}
74 78
75 base::Closure WaitableMessageLoopEvent::GetClosure() { 79 base::Closure WaitableMessageLoopEvent::GetClosure() {
76 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 80 DCHECK_EQ(message_loop_, base::MessageLoop::current());
77 return BindToCurrentLoop(base::Bind( 81 return BindToCurrentLoop(base::Bind(
78 &WaitableMessageLoopEvent::OnCallback, base::Unretained(this), 82 &WaitableMessageLoopEvent::OnCallback, base::Unretained(this),
79 PIPELINE_OK)); 83 PIPELINE_OK));
(...skipping 11 matching lines...) Expand all
91 95
92 void WaitableMessageLoopEvent::RunAndWaitForStatus(PipelineStatus expected) { 96 void WaitableMessageLoopEvent::RunAndWaitForStatus(PipelineStatus expected) {
93 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 97 DCHECK_EQ(message_loop_, base::MessageLoop::current());
94 if (signaled_) { 98 if (signaled_) {
95 EXPECT_EQ(expected, status_); 99 EXPECT_EQ(expected, status_);
96 return; 100 return;
97 } 101 }
98 102
99 run_loop_.reset(new base::RunLoop()); 103 run_loop_.reset(new base::RunLoop());
100 base::Timer timer(false, false); 104 base::Timer timer(false, false);
101 timer.Start(FROM_HERE, TestTimeouts::action_timeout(), base::Bind( 105 timer.Start(
102 &WaitableMessageLoopEvent::OnTimeout, base::Unretained(this))); 106 FROM_HERE, timeout_,
107 base::Bind(&WaitableMessageLoopEvent::OnTimeout, base::Unretained(this)));
103 108
104 run_loop_->Run(); 109 run_loop_->Run();
105 EXPECT_TRUE(signaled_); 110 EXPECT_TRUE(signaled_);
106 EXPECT_EQ(expected, status_); 111 EXPECT_EQ(expected, status_);
107 run_loop_.reset(); 112 run_loop_.reset();
108 } 113 }
109 114
110 void WaitableMessageLoopEvent::OnCallback(PipelineStatus status) { 115 void WaitableMessageLoopEvent::OnCallback(PipelineStatus status) {
111 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 116 DCHECK_EQ(message_loop_, base::MessageLoop::current());
112 signaled_ = true; 117 signaled_ = true;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 int width = 0; 275 int width = 0;
271 int height = 0; 276 int height = 0;
272 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) && 277 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) &&
273 pickle.ReadInt(&height); 278 pickle.ReadInt(&height);
274 return (success && header == kFakeVideoBufferHeader && 279 return (success && header == kFakeVideoBufferHeader &&
275 width == config.coded_size().width() && 280 width == config.coded_size().width() &&
276 height == config.coded_size().height()); 281 height == config.coded_size().height());
277 } 282 }
278 283
279 } // namespace media 284 } // namespace media
OLDNEW
« no previous file with comments | « media/base/test_helpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698