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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 data_source_->OnBufferingHaveEnough(); | 1208 data_source_->OnBufferingHaveEnough(); |
1209 ASSERT_TRUE(active_loader()); | 1209 ASSERT_TRUE(active_loader()); |
1210 | 1210 |
1211 EXPECT_CALL(*this, ReadCallback(kDataSize)); | 1211 EXPECT_CALL(*this, ReadCallback(kDataSize)); |
1212 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); | 1212 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); |
1213 ReceiveData(kDataSize); | 1213 ReceiveData(kDataSize); |
1214 | 1214 |
1215 EXPECT_FALSE(active_loader_allownull()); | 1215 EXPECT_FALSE(active_loader_allownull()); |
1216 } | 1216 } |
1217 | 1217 |
| 1218 TEST_F(MultibufferDataSourceTest, SeekPastEOF) { |
| 1219 GURL gurl(kHttpUrl); |
| 1220 data_source_.reset(new MockMultibufferDataSource( |
| 1221 gurl, message_loop_.task_runner(), url_index_, |
| 1222 view_->mainFrame()->toWebLocalFrame(), &host_)); |
| 1223 data_source_->SetPreload(preload_); |
| 1224 |
| 1225 response_generator_.reset(new TestResponseGenerator(gurl, kDataSize + 1)); |
| 1226 EXPECT_CALL(*this, OnInitialize(true)); |
| 1227 data_source_->Initialize(base::Bind(&MultibufferDataSourceTest::OnInitialize, |
| 1228 base::Unretained(this))); |
| 1229 message_loop_.RunUntilIdle(); |
| 1230 |
| 1231 // Not really loading until after OnInitialize is called. |
| 1232 EXPECT_EQ(data_source_->downloading(), false); |
| 1233 |
| 1234 EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); |
| 1235 Respond(response_generator_->Generate206(0)); |
| 1236 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); |
| 1237 ReceiveData(kDataSize); |
| 1238 |
| 1239 // Read a bit from the beginning. |
| 1240 EXPECT_CALL(*this, ReadCallback(kDataSize)); |
| 1241 ReadAt(0); |
| 1242 |
| 1243 ReceiveData(1); |
| 1244 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3)); |
| 1245 FinishLoading(); |
| 1246 EXPECT_CALL(*this, ReadCallback(0)); |
| 1247 |
| 1248 ReadAt(kDataSize + 5, kDataSize * 2); |
| 1249 Stop(); |
| 1250 } |
| 1251 |
1218 } // namespace media | 1252 } // namespace media |
OLD | NEW |