| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.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" |
| 11 #include "media/base/filter_host.h" | 11 #include "media/base/filter_host.h" |
| 12 #include "media/base/filters.h" | 12 #include "media/base/filters.h" |
| 13 #include "media/base/media_log.h" | 13 #include "media/base/media_log.h" |
| 14 #include "media/base/pipeline_impl.h" | 14 #include "media/base/pipeline_impl.h" |
| 15 #include "media/base/mock_callback.h" | 15 #include "media/base/mock_callback.h" |
| 16 #include "media/base/mock_filters.h" | 16 #include "media/base/mock_filters.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "ui/gfx/size.h" |
| 18 | 19 |
| 19 using ::testing::_; | 20 using ::testing::_; |
| 20 using ::testing::DeleteArg; | 21 using ::testing::DeleteArg; |
| 21 using ::testing::InSequence; | 22 using ::testing::InSequence; |
| 22 using ::testing::Invoke; | 23 using ::testing::Invoke; |
| 23 using ::testing::Mock; | 24 using ::testing::Mock; |
| 24 using ::testing::NotNull; | 25 using ::testing::NotNull; |
| 25 using ::testing::Return; | 26 using ::testing::Return; |
| 26 using ::testing::ReturnRef; | 27 using ::testing::ReturnRef; |
| 27 using ::testing::StrictMock; | 28 using ::testing::StrictMock; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 EXPECT_EQ(0.0f, pipeline_->GetVolume()); | 302 EXPECT_EQ(0.0f, pipeline_->GetVolume()); |
| 302 | 303 |
| 303 EXPECT_TRUE(kZero == pipeline_->GetCurrentTime()); | 304 EXPECT_TRUE(kZero == pipeline_->GetCurrentTime()); |
| 304 EXPECT_TRUE(kZero == pipeline_->GetBufferedTime()); | 305 EXPECT_TRUE(kZero == pipeline_->GetBufferedTime()); |
| 305 EXPECT_TRUE(kZero == pipeline_->GetMediaDuration()); | 306 EXPECT_TRUE(kZero == pipeline_->GetMediaDuration()); |
| 306 | 307 |
| 307 EXPECT_EQ(0, pipeline_->GetBufferedBytes()); | 308 EXPECT_EQ(0, pipeline_->GetBufferedBytes()); |
| 308 EXPECT_EQ(0, pipeline_->GetTotalBytes()); | 309 EXPECT_EQ(0, pipeline_->GetTotalBytes()); |
| 309 | 310 |
| 310 // Should always get set to zero. | 311 // Should always get set to zero. |
| 311 size_t width = 1u; | 312 gfx::Size size(1, 1); |
| 312 size_t height = 1u; | 313 pipeline_->GetNaturalVideoSize(&size); |
| 313 pipeline_->GetVideoSize(&width, &height); | 314 EXPECT_EQ(0, size.width()); |
| 314 EXPECT_EQ(0u, width); | 315 EXPECT_EQ(0, size.height()); |
| 315 EXPECT_EQ(0u, height); | |
| 316 } | 316 } |
| 317 | 317 |
| 318 TEST_F(PipelineImplTest, NeverInitializes) { | 318 TEST_F(PipelineImplTest, NeverInitializes) { |
| 319 // This test hangs during initialization by never calling | 319 // This test hangs during initialization by never calling |
| 320 // InitializationComplete(). StrictMock<> will ensure that the callback is | 320 // InitializationComplete(). StrictMock<> will ensure that the callback is |
| 321 // never executed. | 321 // never executed. |
| 322 pipeline_->Start(mocks_->filter_collection(false, | 322 pipeline_->Start(mocks_->filter_collection(false, |
| 323 false, | 323 false, |
| 324 true, | 324 true, |
| 325 PIPELINE_OK), | 325 PIPELINE_OK), |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 TestPipelineStatusNotification(0); | 868 TestPipelineStatusNotification(0); |
| 869 } | 869 } |
| 870 | 870 |
| 871 // Test that different-thread, some-delay callback (the expected common case) | 871 // Test that different-thread, some-delay callback (the expected common case) |
| 872 // works correctly. | 872 // works correctly. |
| 873 TEST(PipelineStatusNotificationTest, DelayedCallback) { | 873 TEST(PipelineStatusNotificationTest, DelayedCallback) { |
| 874 TestPipelineStatusNotification(20); | 874 TestPipelineStatusNotification(20); |
| 875 } | 875 } |
| 876 | 876 |
| 877 } // namespace media | 877 } // namespace media |
| OLD | NEW |