OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/threading/simple_thread.h" | 9 #include "base/threading/simple_thread.h" |
10 #include "media/base/filter_host.h" | |
11 #include "media/base/filters.h" | |
scherkus (not reviewing)
2011/08/09 20:52:33
thanks :)
| |
12 #include "media/base/media_log.h" | |
10 #include "media/base/pipeline_impl.h" | 13 #include "media/base/pipeline_impl.h" |
11 #include "media/base/filters.h" | |
12 #include "media/base/filter_host.h" | |
13 #include "media/base/mock_callback.h" | 14 #include "media/base/mock_callback.h" |
14 #include "media/base/mock_filters.h" | 15 #include "media/base/mock_filters.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 using ::testing::_; | 18 using ::testing::_; |
18 using ::testing::DeleteArg; | 19 using ::testing::DeleteArg; |
19 using ::testing::InSequence; | 20 using ::testing::InSequence; |
20 using ::testing::Invoke; | 21 using ::testing::Invoke; |
21 using ::testing::Mock; | 22 using ::testing::Mock; |
22 using ::testing::NotNull; | 23 using ::testing::NotNull; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 | 55 |
55 // TODO(scherkus): even though some filters are initialized on separate | 56 // TODO(scherkus): even though some filters are initialized on separate |
56 // threads these test aren't flaky... why? It's because filters' Initialize() | 57 // threads these test aren't flaky... why? It's because filters' Initialize() |
57 // is executed on |message_loop_| and the mock filters instantly call | 58 // is executed on |message_loop_| and the mock filters instantly call |
58 // InitializationComplete(), which keeps the pipeline humming along. If | 59 // InitializationComplete(), which keeps the pipeline humming along. If |
59 // either filters don't call InitializationComplete() immediately or filter | 60 // either filters don't call InitializationComplete() immediately or filter |
60 // initialization is moved to a separate thread this test will become flaky. | 61 // initialization is moved to a separate thread this test will become flaky. |
61 class PipelineImplTest : public ::testing::Test { | 62 class PipelineImplTest : public ::testing::Test { |
62 public: | 63 public: |
63 PipelineImplTest() | 64 PipelineImplTest() |
64 : pipeline_(new PipelineImpl(&message_loop_)) { | 65 : pipeline_(new PipelineImpl(&message_loop_, new MediaLog())) { |
65 pipeline_->Init( | 66 pipeline_->Init( |
66 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_), | 67 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_), |
67 &CallbackHelper::OnEnded), | 68 &CallbackHelper::OnEnded), |
68 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_), | 69 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_), |
69 &CallbackHelper::OnError), | 70 &CallbackHelper::OnError), |
70 static_cast<PipelineStatusCallback*>(NULL)); | 71 static_cast<PipelineStatusCallback*>(NULL)); |
71 mocks_.reset(new MockFilterCollection()); | 72 mocks_.reset(new MockFilterCollection()); |
72 | 73 |
73 // InitializeDemuxer adds overriding expectations for expected non-NULL | 74 // InitializeDemuxer adds overriding expectations for expected non-NULL |
74 // streams. | 75 // streams. |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
892 TestPipelineStatusNotification(0); | 893 TestPipelineStatusNotification(0); |
893 } | 894 } |
894 | 895 |
895 // Test that different-thread, some-delay callback (the expected common case) | 896 // Test that different-thread, some-delay callback (the expected common case) |
896 // works correctly. | 897 // works correctly. |
897 TEST(PipelineStatusNotificationTest, DelayedCallback) { | 898 TEST(PipelineStatusNotificationTest, DelayedCallback) { |
898 TestPipelineStatusNotification(20); | 899 TestPipelineStatusNotification(20); |
899 } | 900 } |
900 | 901 |
901 } // namespace media | 902 } // namespace media |
OLD | NEW |