| 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 "content/public/common/url_constants.h" | 7 #include "content/public/common/url_constants.h" |
| 8 #include "content/renderer/media/buffered_data_source.h" | 8 #include "content/renderer/media/buffered_data_source.h" |
| 9 #include "content/renderer/media/test_response_generator.h" | 9 #include "content/renderer/media/test_response_generator.h" |
| 10 #include "content/test/mock_webframeclient.h" | 10 #include "content/test/mock_webframeclient.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 GURL gurl(url); | 125 GURL gurl(url); |
| 126 response_generator_.reset(new TestResponseGenerator(gurl, kFileSize)); | 126 response_generator_.reset(new TestResponseGenerator(gurl, kFileSize)); |
| 127 | 127 |
| 128 ExpectCreateResourceLoader(); | 128 ExpectCreateResourceLoader(); |
| 129 EXPECT_CALL(*this, OnInitialize(expected)); | 129 EXPECT_CALL(*this, OnInitialize(expected)); |
| 130 data_source_->Initialize( | 130 data_source_->Initialize( |
| 131 gurl, BufferedResourceLoader::kUnspecified, base::Bind( | 131 gurl, BufferedResourceLoader::kUnspecified, base::Bind( |
| 132 &BufferedDataSourceTest::OnInitialize, base::Unretained(this))); | 132 &BufferedDataSourceTest::OnInitialize, base::Unretained(this))); |
| 133 message_loop_.RunUntilIdle(); | 133 message_loop_.RunUntilIdle(); |
| 134 | 134 |
| 135 bool is_http = gurl.SchemeIs(kHttpScheme) || gurl.SchemeIs(kHttpsScheme); | 135 bool is_http = |
| 136 gurl.SchemeIs(url::kHttpScheme) || gurl.SchemeIs(url::kHttpsScheme); |
| 136 EXPECT_EQ(data_source_->downloading(), is_http); | 137 EXPECT_EQ(data_source_->downloading(), is_http); |
| 137 } | 138 } |
| 138 | 139 |
| 139 // Helper to initialize tests with a valid 206 response. | 140 // Helper to initialize tests with a valid 206 response. |
| 140 void InitializeWith206Response() { | 141 void InitializeWith206Response() { |
| 141 Initialize(kHttpUrl, true); | 142 Initialize(kHttpUrl, true); |
| 142 | 143 |
| 143 EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); | 144 EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); |
| 144 Respond(response_generator_->Generate206(0)); | 145 Respond(response_generator_->Generate206(0)); |
| 145 } | 146 } |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 InitializeWithFileResponse(); | 663 InitializeWithFileResponse(); |
| 663 | 664 |
| 664 EXPECT_FALSE(data_source_->downloading()); | 665 EXPECT_FALSE(data_source_->downloading()); |
| 665 FinishLoading(); | 666 FinishLoading(); |
| 666 EXPECT_FALSE(data_source_->downloading()); | 667 EXPECT_FALSE(data_source_->downloading()); |
| 667 | 668 |
| 668 Stop(); | 669 Stop(); |
| 669 } | 670 } |
| 670 | 671 |
| 671 } // namespace content | 672 } // namespace content |
| OLD | NEW |