| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind.h" | 5 #include "base/bind.h" | 
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" | 
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" | 
| 8 #include "media/base/media_log.h" | 8 #include "media/base/media_log.h" | 
| 9 #include "media/base/mock_filters.h" | 9 #include "media/base/mock_filters.h" | 
| 10 #include "media/base/test_helpers.h" | 10 #include "media/base/test_helpers.h" | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 40 class TestMultiBufferDataProvider; | 40 class TestMultiBufferDataProvider; | 
| 41 | 41 | 
| 42 std::set<TestMultiBufferDataProvider*> test_data_providers; | 42 std::set<TestMultiBufferDataProvider*> test_data_providers; | 
| 43 | 43 | 
| 44 class TestMultiBufferDataProvider : public ResourceMultiBufferDataProvider { | 44 class TestMultiBufferDataProvider : public ResourceMultiBufferDataProvider { | 
| 45  public: | 45  public: | 
| 46   TestMultiBufferDataProvider(UrlData* url_data, MultiBuffer::BlockId pos) | 46   TestMultiBufferDataProvider(UrlData* url_data, MultiBuffer::BlockId pos) | 
| 47       : ResourceMultiBufferDataProvider(url_data, pos), loading_(false) { | 47       : ResourceMultiBufferDataProvider(url_data, pos), loading_(false) { | 
| 48     CHECK(test_data_providers.insert(this).second); | 48     CHECK(test_data_providers.insert(this).second); | 
| 49   } | 49   } | 
| 50   ~TestMultiBufferDataProvider() { | 50   ~TestMultiBufferDataProvider() override { | 
| 51     CHECK_EQ(static_cast<size_t>(1), test_data_providers.erase(this)); | 51     CHECK_EQ(static_cast<size_t>(1), test_data_providers.erase(this)); | 
| 52   } | 52   } | 
| 53   void Start() override { | 53   void Start() override { | 
| 54     // Create a mock active loader. | 54     // Create a mock active loader. | 
| 55     // Keep track of active loading state via loadAsynchronously() and cancel(). | 55     // Keep track of active loading state via loadAsynchronously() and cancel(). | 
| 56     NiceMock<MockWebURLLoader>* url_loader = new NiceMock<MockWebURLLoader>(); | 56     NiceMock<MockWebURLLoader>* url_loader = new NiceMock<MockWebURLLoader>(); | 
| 57     ON_CALL(*url_loader, cancel()).WillByDefault(Assign(&loading_, false)); | 57     ON_CALL(*url_loader, cancel()).WillByDefault(Assign(&loading_, false)); | 
| 58     loading_ = true; | 58     loading_ = true; | 
| 59     active_loader_.reset( | 59     active_loader_.reset( | 
| 60         new ActiveLoader(scoped_ptr<WebURLLoader>(url_loader))); | 60         new ActiveLoader(scoped_ptr<WebURLLoader>(url_loader))); | 
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1196   ASSERT_TRUE(active_loader()); | 1196   ASSERT_TRUE(active_loader()); | 
| 1197 | 1197 | 
| 1198   EXPECT_CALL(*this, ReadCallback(kDataSize)); | 1198   EXPECT_CALL(*this, ReadCallback(kDataSize)); | 
| 1199   EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); | 1199   EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); | 
| 1200   ReceiveData(kDataSize); | 1200   ReceiveData(kDataSize); | 
| 1201 | 1201 | 
| 1202   EXPECT_FALSE(active_loader_allownull()); | 1202   EXPECT_FALSE(active_loader_allownull()); | 
| 1203 } | 1203 } | 
| 1204 | 1204 | 
| 1205 }  // namespace media | 1205 }  // namespace media | 
| OLD | NEW | 
|---|