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" |
11 #include "content/test/mock_weburlloader.h" | 11 #include "content/test/mock_weburlloader.h" |
12 #include "media/base/media_log.h" | 12 #include "media/base/media_log.h" |
13 #include "media/base/mock_filters.h" | 13 #include "media/base/mock_filters.h" |
14 #include "media/base/test_helpers.h" | 14 #include "media/base/test_helpers.h" |
| 15 #include "net/base/url_constants.h" |
15 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 16 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
16 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
17 #include "third_party/WebKit/public/web/WebView.h" | 18 #include "third_party/WebKit/public/web/WebView.h" |
18 | 19 |
19 using ::testing::_; | 20 using ::testing::_; |
20 using ::testing::Assign; | 21 using ::testing::Assign; |
21 using ::testing::Invoke; | 22 using ::testing::Invoke; |
22 using ::testing::InSequence; | 23 using ::testing::InSequence; |
23 using ::testing::NiceMock; | 24 using ::testing::NiceMock; |
24 using ::testing::StrictMock; | 25 using ::testing::StrictMock; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 GURL gurl(url); | 126 GURL gurl(url); |
126 response_generator_.reset(new TestResponseGenerator(gurl, kFileSize)); | 127 response_generator_.reset(new TestResponseGenerator(gurl, kFileSize)); |
127 | 128 |
128 ExpectCreateResourceLoader(); | 129 ExpectCreateResourceLoader(); |
129 EXPECT_CALL(*this, OnInitialize(expected)); | 130 EXPECT_CALL(*this, OnInitialize(expected)); |
130 data_source_->Initialize( | 131 data_source_->Initialize( |
131 gurl, BufferedResourceLoader::kUnspecified, base::Bind( | 132 gurl, BufferedResourceLoader::kUnspecified, base::Bind( |
132 &BufferedDataSourceTest::OnInitialize, base::Unretained(this))); | 133 &BufferedDataSourceTest::OnInitialize, base::Unretained(this))); |
133 message_loop_.RunUntilIdle(); | 134 message_loop_.RunUntilIdle(); |
134 | 135 |
135 bool is_http = gurl.SchemeIs(kHttpScheme) || gurl.SchemeIs(kHttpsScheme); | 136 bool is_http = |
| 137 gurl.SchemeIs(net::kHttpScheme) || gurl.SchemeIs(net::kHttpsScheme); |
136 EXPECT_EQ(data_source_->downloading(), is_http); | 138 EXPECT_EQ(data_source_->downloading(), is_http); |
137 } | 139 } |
138 | 140 |
139 // Helper to initialize tests with a valid 206 response. | 141 // Helper to initialize tests with a valid 206 response. |
140 void InitializeWith206Response() { | 142 void InitializeWith206Response() { |
141 Initialize(kHttpUrl, true); | 143 Initialize(kHttpUrl, true); |
142 | 144 |
143 EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); | 145 EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); |
144 Respond(response_generator_->Generate206(0)); | 146 Respond(response_generator_->Generate206(0)); |
145 } | 147 } |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 InitializeWithFileResponse(); | 664 InitializeWithFileResponse(); |
663 | 665 |
664 EXPECT_FALSE(data_source_->downloading()); | 666 EXPECT_FALSE(data_source_->downloading()); |
665 FinishLoading(); | 667 FinishLoading(); |
666 EXPECT_FALSE(data_source_->downloading()); | 668 EXPECT_FALSE(data_source_->downloading()); |
667 | 669 |
668 Stop(); | 670 Stop(); |
669 } | 671 } |
670 | 672 |
671 } // namespace content | 673 } // namespace content |
OLD | NEW |