| 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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); | 1371 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); |
| 1372 ReceiveData(kDataSize); | 1372 ReceiveData(kDataSize); |
| 1373 | 1373 |
| 1374 EXPECT_FALSE(data_source_->IsStreaming()); | 1374 EXPECT_FALSE(data_source_->IsStreaming()); |
| 1375 | 1375 |
| 1376 FinishLoading(); | 1376 FinishLoading(); |
| 1377 EXPECT_FALSE(loading()); | 1377 EXPECT_FALSE(loading()); |
| 1378 Stop(); | 1378 Stop(); |
| 1379 } | 1379 } |
| 1380 | 1380 |
| 1381 TEST_F(MultibufferDataSourceTest, LengthKnownAtEOF) { |
| 1382 Initialize(kHttpUrl, true); |
| 1383 // Server responds without content-length. |
| 1384 WebURLResponse response = response_generator_->Generate200(); |
| 1385 response.clearHTTPHeaderField(WebString::fromUTF8("Content-Length")); |
| 1386 response.setExpectedContentLength(kPositionNotSpecified); |
| 1387 Respond(response); |
| 1388 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); |
| 1389 ReceiveData(kDataSize); |
| 1390 int64_t len; |
| 1391 EXPECT_FALSE(data_source_->GetSize(&len)); |
| 1392 EXPECT_TRUE(data_source_->IsStreaming()); |
| 1393 EXPECT_CALL(*this, ReadCallback(kDataSize)); |
| 1394 ReadAt(0); |
| 1395 |
| 1396 ReadAt(kDataSize); |
| 1397 EXPECT_CALL(host_, SetTotalBytes(kDataSize)); |
| 1398 EXPECT_CALL(*this, ReadCallback(0)); |
| 1399 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); |
| 1400 FinishLoading(); |
| 1401 |
| 1402 // Done loading, now we should know the length. |
| 1403 EXPECT_TRUE(data_source_->GetSize(&len)); |
| 1404 EXPECT_EQ(kDataSize, len); |
| 1405 Stop(); |
| 1406 } |
| 1407 |
| 1381 } // namespace media | 1408 } // namespace media |
| OLD | NEW |