| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/base/media_url_demuxer.h" | 5 #include "media/base/media_url_demuxer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/test/scoped_task_environment.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.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 { |
| 16 | 17 |
| 17 class MediaUrlDemuxerTest : public testing::Test { | 18 class MediaUrlDemuxerTest : public testing::Test { |
| 18 public: | 19 public: |
| 19 MediaUrlDemuxerTest() | 20 MediaUrlDemuxerTest() |
| 20 : default_media_url_("http://example.com/file.mp4"), | 21 : default_media_url_("http://example.com/file.mp4"), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 | 32 |
| 32 void VerifyCallbackOk(PipelineStatus status) { | 33 void VerifyCallbackOk(PipelineStatus status) { |
| 33 EXPECT_EQ(PIPELINE_OK, status); | 34 EXPECT_EQ(PIPELINE_OK, status); |
| 34 } | 35 } |
| 35 | 36 |
| 36 GURL default_media_url_; | 37 GURL default_media_url_; |
| 37 GURL default_first_party_url_; | 38 GURL default_first_party_url_; |
| 38 std::unique_ptr<Demuxer> demuxer_; | 39 std::unique_ptr<Demuxer> demuxer_; |
| 39 | 40 |
| 40 // Necessary, or else base::ThreadTaskRunnerHandle::Get() fails. | 41 // Necessary, or else base::ThreadTaskRunnerHandle::Get() fails. |
| 41 base::MessageLoop message_loop_; | 42 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(MediaUrlDemuxerTest); | 45 DISALLOW_COPY_AND_ASSIGN(MediaUrlDemuxerTest); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 TEST_F(MediaUrlDemuxerTest, BaseCase) { | 48 TEST_F(MediaUrlDemuxerTest, BaseCase) { |
| 48 InitializeTest(); | 49 InitializeTest(); |
| 49 | 50 |
| 50 EXPECT_EQ(MediaResource::Type::URL, demuxer_->GetType()); | 51 EXPECT_EQ(MediaResource::Type::URL, demuxer_->GetType()); |
| 51 | 52 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 75 TEST_F(MediaUrlDemuxerTest, SeekReturnsPipelineOk) { | 76 TEST_F(MediaUrlDemuxerTest, SeekReturnsPipelineOk) { |
| 76 InitializeTest(); | 77 InitializeTest(); |
| 77 demuxer_->Seek(base::TimeDelta(), | 78 demuxer_->Seek(base::TimeDelta(), |
| 78 base::Bind(&MediaUrlDemuxerTest::VerifyCallbackOk, | 79 base::Bind(&MediaUrlDemuxerTest::VerifyCallbackOk, |
| 79 base::Unretained(this))); | 80 base::Unretained(this))); |
| 80 | 81 |
| 81 base::RunLoop().RunUntilIdle(); | 82 base::RunLoop().RunUntilIdle(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 } // namespace media | 85 } // namespace media |
| OLD | NEW |