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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 594 |
595 EXPECT_FALSE(loading()); | 595 EXPECT_FALSE(loading()); |
596 Stop(); | 596 Stop(); |
597 } | 597 } |
598 | 598 |
599 // Test the case where the initial response from the server indicates that | 599 // Test the case where the initial response from the server indicates that |
600 // Range requests are supported, but a later request prove otherwise. | 600 // Range requests are supported, but a later request prove otherwise. |
601 TEST_F(MultibufferDataSourceTest, Range_ServerLied) { | 601 TEST_F(MultibufferDataSourceTest, Range_ServerLied) { |
602 InitializeWith206Response(); | 602 InitializeWith206Response(); |
603 | 603 |
604 // Read causing a new request to be made -- we'll expect it to error. | 604 // Read causing a new request to be made, we will discard the data that |
| 605 // was already read in the first request. |
605 ReadAt(kFarReadPosition); | 606 ReadAt(kFarReadPosition); |
606 | 607 |
607 // Return a 200 in response to a range request. | 608 // Return a 200 in response to a range request. |
608 EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); | 609 EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); |
609 Respond(response_generator_->Generate200()); | 610 Respond(response_generator_->Generate200()); |
610 | 611 |
611 EXPECT_FALSE(loading()); | 612 EXPECT_TRUE(loading()); |
612 Stop(); | 613 Stop(); |
613 } | 614 } |
614 | 615 |
615 TEST_F(MultibufferDataSourceTest, Http_AbortWhileReading) { | 616 TEST_F(MultibufferDataSourceTest, Http_AbortWhileReading) { |
616 InitializeWith206Response(); | 617 InitializeWith206Response(); |
617 | 618 |
618 // Make sure there's a pending read -- we'll expect it to error. | 619 // Make sure there's a pending read -- we'll expect it to error. |
619 ReadAt(kFileSize); | 620 ReadAt(kFileSize); |
620 | 621 |
621 // Abort!!! | 622 // Abort!!! |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 base::Bind(&MultibufferDataSourceTest::ReadCallback, | 1622 base::Bind(&MultibufferDataSourceTest::ReadCallback, |
1622 base::Unretained(this))); | 1623 base::Unretained(this))); |
1623 base::RunLoop().RunUntilIdle(); | 1624 base::RunLoop().RunUntilIdle(); |
1624 | 1625 |
1625 // Make sure we're not downloading anymore. | 1626 // Make sure we're not downloading anymore. |
1626 EXPECT_EQ(data_source_->downloading(), false); | 1627 EXPECT_EQ(data_source_->downloading(), false); |
1627 Stop(); | 1628 Stop(); |
1628 } | 1629 } |
1629 | 1630 |
1630 } // namespace media | 1631 } // namespace media |
OLD | NEW |