| 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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); | 1332 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); |
| 1333 ReceiveData(kDataSize); | 1333 ReceiveData(kDataSize); |
| 1334 | 1334 |
| 1335 EXPECT_FALSE(data_source_->IsStreaming()); | 1335 EXPECT_FALSE(data_source_->IsStreaming()); |
| 1336 | 1336 |
| 1337 FinishLoading(); | 1337 FinishLoading(); |
| 1338 EXPECT_FALSE(loading()); | 1338 EXPECT_FALSE(loading()); |
| 1339 Stop(); | 1339 Stop(); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 TEST_F(MultibufferDataSourceTest, LengthKnownAtEOF) { |
| 1343 Initialize(kHttpUrl, true); |
| 1344 // Server responds without content-length. |
| 1345 WebURLResponse response = response_generator_->Generate200(); |
| 1346 response.clearHTTPHeaderField(WebString::fromUTF8("Content-Length")); |
| 1347 response.setExpectedContentLength(kPositionNotSpecified); |
| 1348 Respond(response); |
| 1349 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); |
| 1350 ReceiveData(kDataSize); |
| 1351 int64_t len; |
| 1352 EXPECT_FALSE(data_source_->GetSize(&len)); |
| 1353 EXPECT_TRUE(data_source_->IsStreaming()); |
| 1354 EXPECT_CALL(*this, ReadCallback(kDataSize)); |
| 1355 ReadAt(0); |
| 1356 |
| 1357 ReadAt(kDataSize); |
| 1358 EXPECT_CALL(host_, SetTotalBytes(kDataSize)); |
| 1359 EXPECT_CALL(*this, ReadCallback(0)); |
| 1360 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); |
| 1361 FinishLoading(); |
| 1362 |
| 1363 // Done loading, now we should know the length. |
| 1364 EXPECT_TRUE(data_source_->GetSize(&len)); |
| 1365 EXPECT_EQ(kDataSize, len); |
| 1366 Stop(); |
| 1367 } |
| 1368 |
| 1342 } // namespace media | 1369 } // namespace media |
| OLD | NEW |