| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/debug/stack_trace.h" | 6 #include "base/debug/stack_trace.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "media/base/pipeline_status.h" | 8 #include "media/base/pipeline_status.h" |
| 9 #include "media/base/serial_runner.h" | 9 #include "media/base/serial_runner.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 | 13 |
| 14 class SerialRunnerTest : public ::testing::Test { | 14 class SerialRunnerTest : public ::testing::Test { |
| 15 public: | 15 public: |
| 16 SerialRunnerTest() | 16 SerialRunnerTest() |
| 17 : inside_start_(false), done_called_(false), done_status_(PIPELINE_OK) {} | 17 : inside_start_(false), done_called_(false), done_status_(PIPELINE_OK) {} |
| 18 virtual ~SerialRunnerTest() {} | 18 ~SerialRunnerTest() override {} |
| 19 | 19 |
| 20 void RunSerialRunner() { | 20 void RunSerialRunner() { |
| 21 message_loop_.PostTask(FROM_HERE, base::Bind( | 21 message_loop_.PostTask(FROM_HERE, base::Bind( |
| 22 &SerialRunnerTest::StartRunnerInternal, base::Unretained(this), | 22 &SerialRunnerTest::StartRunnerInternal, base::Unretained(this), |
| 23 bound_fns_)); | 23 bound_fns_)); |
| 24 message_loop_.RunUntilIdle(); | 24 message_loop_.RunUntilIdle(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Pushes a bound function to the queue that will run its callback with | 27 // Pushes a bound function to the queue that will run its callback with |
| 28 // |status|. called(i) returns whether the i'th bound function pushed to the | 28 // |status|. called(i) returns whether the i'th bound function pushed to the |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 TEST_F(SerialRunnerTest, Closure) { | 219 TEST_F(SerialRunnerTest, Closure) { |
| 220 PushClosure(); | 220 PushClosure(); |
| 221 RunSerialRunner(); | 221 RunSerialRunner(); |
| 222 | 222 |
| 223 EXPECT_TRUE(called(0)); | 223 EXPECT_TRUE(called(0)); |
| 224 EXPECT_TRUE(done_called()); | 224 EXPECT_TRUE(done_called()); |
| 225 EXPECT_EQ(PIPELINE_OK, done_status()); | 225 EXPECT_EQ(PIPELINE_OK, done_status()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace media | 228 } // namespace media |
| OLD | NEW |