OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/threading/simple_thread.h" | 10 #include "base/threading/simple_thread.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // TODO(scherkus): even though some filters are initialized on separate | 69 // TODO(scherkus): even though some filters are initialized on separate |
70 // threads these test aren't flaky... why? It's because filters' Initialize() | 70 // threads these test aren't flaky... why? It's because filters' Initialize() |
71 // is executed on |message_loop_| and the mock filters instantly call | 71 // is executed on |message_loop_| and the mock filters instantly call |
72 // InitializationComplete(), which keeps the pipeline humming along. If | 72 // InitializationComplete(), which keeps the pipeline humming along. If |
73 // either filters don't call InitializationComplete() immediately or filter | 73 // either filters don't call InitializationComplete() immediately or filter |
74 // initialization is moved to a separate thread this test will become flaky. | 74 // initialization is moved to a separate thread this test will become flaky. |
75 class PipelineTest : public ::testing::Test { | 75 class PipelineTest : public ::testing::Test { |
76 public: | 76 public: |
77 PipelineTest() | 77 PipelineTest() |
78 : pipeline_(new Pipeline(&message_loop_, new MediaLog())) { | 78 : pipeline_(new Pipeline(message_loop_.message_loop_proxy(), |
| 79 new MediaLog())) { |
79 mocks_.reset(new MockFilterCollection()); | 80 mocks_.reset(new MockFilterCollection()); |
80 | 81 |
81 // InitializeDemuxer() adds overriding expectations for expected non-NULL | 82 // InitializeDemuxer() adds overriding expectations for expected non-NULL |
82 // streams. | 83 // streams. |
83 DemuxerStream* null_pointer = NULL; | 84 DemuxerStream* null_pointer = NULL; |
84 EXPECT_CALL(*mocks_->demuxer(), GetStream(_)) | 85 EXPECT_CALL(*mocks_->demuxer(), GetStream(_)) |
85 .WillRepeatedly(Return(null_pointer)); | 86 .WillRepeatedly(Return(null_pointer)); |
86 | 87 |
87 EXPECT_CALL(*mocks_->demuxer(), GetStartTime()) | 88 EXPECT_CALL(*mocks_->demuxer(), GetStartTime()) |
88 .WillRepeatedly(Return(base::TimeDelta())); | 89 .WillRepeatedly(Return(base::TimeDelta())); |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); | 1071 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); |
1071 } | 1072 } |
1072 | 1073 |
1073 // Test that different-thread, some-delay callback (the expected common case) | 1074 // Test that different-thread, some-delay callback (the expected common case) |
1074 // works correctly. | 1075 // works correctly. |
1075 TEST(PipelineStatusNotificationTest, DelayedCallback) { | 1076 TEST(PipelineStatusNotificationTest, DelayedCallback) { |
1076 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); | 1077 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); |
1077 } | 1078 } |
1078 | 1079 |
1079 } // namespace media | 1080 } // namespace media |
OLD | NEW |