| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <memory> |
| 6 | 7 |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "media/base/pipeline_status.h" | 12 #include "media/base/pipeline_status.h" |
| 12 #include "media/base/serial_runner.h" | 13 #include "media/base/serial_runner.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 &SerialRunnerTest::ResetSerialRunner, base::Unretained(this))); | 122 &SerialRunnerTest::ResetSerialRunner, base::Unretained(this))); |
| 122 status_cb.Run(PIPELINE_OK); | 123 status_cb.Run(PIPELINE_OK); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void ResetSerialRunner() { | 126 void ResetSerialRunner() { |
| 126 runner_.reset(); | 127 runner_.reset(); |
| 127 } | 128 } |
| 128 | 129 |
| 129 base::MessageLoop message_loop_; | 130 base::MessageLoop message_loop_; |
| 130 SerialRunner::Queue bound_fns_; | 131 SerialRunner::Queue bound_fns_; |
| 131 scoped_ptr<SerialRunner> runner_; | 132 std::unique_ptr<SerialRunner> runner_; |
| 132 | 133 |
| 133 // Used to enforce calling stack guarantees of the API. | 134 // Used to enforce calling stack guarantees of the API. |
| 134 bool inside_start_; | 135 bool inside_start_; |
| 135 | 136 |
| 136 // Tracks whether the i'th bound function was called. | 137 // Tracks whether the i'th bound function was called. |
| 137 std::vector<bool> called_; | 138 std::vector<bool> called_; |
| 138 | 139 |
| 139 // Tracks whether the final done callback was called + resulting status. | 140 // Tracks whether the final done callback was called + resulting status. |
| 140 bool done_called_; | 141 bool done_called_; |
| 141 PipelineStatus done_status_; | 142 PipelineStatus done_status_; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 TEST_F(SerialRunnerTest, Closure) { | 223 TEST_F(SerialRunnerTest, Closure) { |
| 223 PushClosure(); | 224 PushClosure(); |
| 224 RunSerialRunner(); | 225 RunSerialRunner(); |
| 225 | 226 |
| 226 EXPECT_TRUE(called(0)); | 227 EXPECT_TRUE(called(0)); |
| 227 EXPECT_TRUE(done_called()); | 228 EXPECT_TRUE(done_called()); |
| 228 EXPECT_EQ(PIPELINE_OK, done_status()); | 229 EXPECT_EQ(PIPELINE_OK, done_status()); |
| 229 } | 230 } |
| 230 | 231 |
| 231 } // namespace media | 232 } // namespace media |
| OLD | NEW |