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

Unified Diff: media/base/serial_runner_unittest.cc

Issue 275673002: Remove completion callbacks from AudioRenderer::Play/Pause(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/serial_runner.cc ('k') | media/filters/audio_renderer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/serial_runner_unittest.cc
diff --git a/media/base/serial_runner_unittest.cc b/media/base/serial_runner_unittest.cc
index 6d21968c0a49d1d05edd48ebb664598e484353c8..f18fef88e9c947c46601aaa9e5b164f5a6582bd5 100644
--- a/media/base/serial_runner_unittest.cc
+++ b/media/base/serial_runner_unittest.cc
@@ -35,6 +35,20 @@ class SerialRunnerTest : public ::testing::Test {
called_.push_back(false);
}
+ void PushBoundClosure() {
+ bound_fns_.Push(base::Bind(&SerialRunnerTest::RunBoundClosure,
+ base::Unretained(this),
+ called_.size()));
+ called_.push_back(false);
+ }
+
+ void PushClosure() {
+ bound_fns_.Push(base::Bind(&SerialRunnerTest::RunClosure,
+ base::Unretained(this),
+ called_.size()));
+ called_.push_back(false);
+ }
+
// Push a bound function to the queue that will delete the SerialRunner,
// which should cancel all remaining queued work.
void PushCancellation() {
@@ -61,6 +75,26 @@ class SerialRunnerTest : public ::testing::Test {
status_cb.Run(status);
}
+ void RunBoundClosure(size_t index,
+ const base::Closure& done_cb) {
+ EXPECT_EQ(index == 0u, inside_start_)
+ << "First bound function should run on same stack as "
+ << "SerialRunner::Run() while all others should not\n"
+ << base::debug::StackTrace().ToString();
+
+ called_[index] = true;
+ done_cb.Run();
+ }
+
+ void RunClosure(size_t index) {
+ EXPECT_EQ(index == 0u, inside_start_)
+ << "First bound function should run on same stack as "
+ << "SerialRunner::Run() while all others should not\n"
+ << base::debug::StackTrace().ToString();
+
+ called_[index] = true;
+ }
+
void StartRunnerInternal(const SerialRunner::Queue& bound_fns) {
inside_start_ = true;
runner_ = SerialRunner::Run(bound_fns_, base::Bind(
@@ -173,4 +207,22 @@ TEST_F(SerialRunnerTest, Multiple_Cancel) {
EXPECT_FALSE(done_called());
}
+TEST_F(SerialRunnerTest, BoundClosure) {
+ PushBoundClosure();
+ RunSerialRunner();
+
+ EXPECT_TRUE(called(0));
+ EXPECT_TRUE(done_called());
+ EXPECT_EQ(PIPELINE_OK, done_status());
+}
+
+TEST_F(SerialRunnerTest, Closure) {
+ PushClosure();
+ RunSerialRunner();
+
+ EXPECT_TRUE(called(0));
+ EXPECT_TRUE(done_called());
+ EXPECT_EQ(PIPELINE_OK, done_status());
+}
+
} // namespace media
« no previous file with comments | « media/base/serial_runner.cc ('k') | media/filters/audio_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698