| Index: media/blink/buffered_data_source_host_impl_unittest.cc
|
| diff --git a/media/blink/buffered_data_source_host_impl_unittest.cc b/media/blink/buffered_data_source_host_impl_unittest.cc
|
| index 54ecf75c3b6ea6652d8af115800b0d502a868bbc..d008acf1c7ffb3457925e897605d246d68f5d926 100644
|
| --- a/media/blink/buffered_data_source_host_impl_unittest.cc
|
| +++ b/media/blink/buffered_data_source_host_impl_unittest.cc
|
| @@ -2,21 +2,28 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/macros.h"
|
| #include "media/blink/buffered_data_source_host_impl.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "base/macros.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace media {
|
|
|
| class BufferedDataSourceHostImplTest : public testing::Test {
|
| public:
|
| - BufferedDataSourceHostImplTest() {}
|
| + BufferedDataSourceHostImplTest()
|
| + : host_(base::Bind(&BufferedDataSourceHostImplTest::ProgressCallback,
|
| + base::Unretained(this))) {}
|
|
|
| void Add() {
|
| host_.AddBufferedTimeRanges(&ranges_, base::TimeDelta::FromSeconds(10));
|
| }
|
|
|
| + void ProgressCallback() { progress_callback_calls_++; }
|
| +
|
| protected:
|
| + int progress_callback_calls_ = 0;
|
| BufferedDataSourceHostImpl host_;
|
| Ranges<base::TimeDelta> ranges_;
|
|
|
| @@ -73,4 +80,20 @@ TEST_F(BufferedDataSourceHostImplTest, DidLoadingProgress) {
|
| EXPECT_FALSE(host_.DidLoadingProgress());
|
| }
|
|
|
| +TEST_F(BufferedDataSourceHostImplTest, CanPlayThrough) {
|
| + host_.SetTotalBytes(100000);
|
| + host_.AddBufferedByteRange(0, 10000);
|
| + host_.AddBufferedByteRange(10000, 20000);
|
| + host_.AddBufferedByteRange(20000, 30000);
|
| + host_.AddBufferedByteRange(30000, 40000);
|
| + host_.AddBufferedByteRange(40000, 50000);
|
| + host_.AddBufferedByteRange(50000, 60000);
|
| + host_.AddBufferedByteRange(60000, 70000);
|
| + host_.AddBufferedByteRange(70000, 80000);
|
| + host_.AddBufferedByteRange(80000, 90000);
|
| + EXPECT_EQ(9, progress_callback_calls_);
|
| + EXPECT_TRUE(host_.CanPlayThrough(base::TimeDelta(),
|
| + base::TimeDelta::FromSecondsD(1000.0), 1.0));
|
| +}
|
| +
|
| } // namespace media
|
|
|