| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "media/blink/resource_multibuffer_data_provider.h" | 5 #include "media/blink/resource_multibuffer_data_provider.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 TEST_F(ResourceMultiBufferDataProviderTest, BadHttpResponse) { | 247 TEST_F(ResourceMultiBufferDataProviderTest, BadHttpResponse) { |
| 248 Initialize(kHttpUrl, 0); | 248 Initialize(kHttpUrl, 0); |
| 249 Start(); | 249 Start(); |
| 250 | 250 |
| 251 EXPECT_CALL(*this, RedirectCallback(scoped_refptr<UrlData>(nullptr))); | 251 EXPECT_CALL(*this, RedirectCallback(scoped_refptr<UrlData>(nullptr))); |
| 252 | 252 |
| 253 WebURLResponse response(gurl_); | 253 WebURLResponse response(gurl_); |
| 254 response.setHTTPStatusCode(404); | 254 response.setHTTPStatusCode(404); |
| 255 response.setHTTPStatusText("Not Found\n"); | 255 response.setHTTPStatusText("Not Found\n"); |
| 256 loader_->didReceiveResponse(url_loader_, response); | 256 loader_->didReceiveResponse(url_loader_, response); |
| 257 StopWhenLoad(); | |
| 258 } | 257 } |
| 259 | 258 |
| 260 // Tests that partial content is requested but not fulfilled. | 259 // Tests that partial content is requested but not fulfilled. |
| 261 TEST_F(ResourceMultiBufferDataProviderTest, NotPartialResponse) { | 260 TEST_F(ResourceMultiBufferDataProviderTest, NotPartialResponse) { |
| 262 Initialize(kHttpUrl, 100); | 261 Initialize(kHttpUrl, 100); |
| 263 Start(); | 262 Start(); |
| 264 FullResponse(1024, false); | 263 FullResponse(1024, false); |
| 265 StopWhenLoad(); | |
| 266 } | 264 } |
| 267 | 265 |
| 268 // Tests that a 200 response is received. | 266 // Tests that a 200 response is received. |
| 269 TEST_F(ResourceMultiBufferDataProviderTest, FullResponse) { | 267 TEST_F(ResourceMultiBufferDataProviderTest, FullResponse) { |
| 270 Initialize(kHttpUrl, 0); | 268 Initialize(kHttpUrl, 0); |
| 271 Start(); | 269 Start(); |
| 272 FullResponse(1024); | 270 FullResponse(1024); |
| 273 StopWhenLoad(); | 271 StopWhenLoad(); |
| 274 } | 272 } |
| 275 | 273 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 310 |
| 313 WebURLResponse response(gurl_); | 311 WebURLResponse response(gurl_); |
| 314 response.setHTTPHeaderField( | 312 response.setHTTPHeaderField( |
| 315 WebString::fromUTF8("Content-Range"), | 313 WebString::fromUTF8("Content-Range"), |
| 316 WebString::fromUTF8(base::StringPrintf("bytes " | 314 WebString::fromUTF8(base::StringPrintf("bytes " |
| 317 "%d-%d/%d", | 315 "%d-%d/%d", |
| 318 1, 10, 1024))); | 316 1, 10, 1024))); |
| 319 response.setExpectedContentLength(10); | 317 response.setExpectedContentLength(10); |
| 320 response.setHTTPStatusCode(kHttpPartialContent); | 318 response.setHTTPStatusCode(kHttpPartialContent); |
| 321 loader_->didReceiveResponse(url_loader_, response); | 319 loader_->didReceiveResponse(url_loader_, response); |
| 322 StopWhenLoad(); | |
| 323 } | 320 } |
| 324 | 321 |
| 325 TEST_F(ResourceMultiBufferDataProviderTest, TestRedirects) { | 322 TEST_F(ResourceMultiBufferDataProviderTest, TestRedirects) { |
| 326 // Test redirect. | 323 // Test redirect. |
| 327 Initialize(kHttpUrl, 0); | 324 Initialize(kHttpUrl, 0); |
| 328 Start(); | 325 Start(); |
| 329 Redirect(kHttpRedirect); | 326 Redirect(kHttpRedirect); |
| 330 FullResponse(1024); | 327 FullResponse(1024); |
| 331 StopWhenLoad(); | 328 StopWhenLoad(); |
| 332 } | 329 } |
| 333 | 330 |
| 334 } // namespace media | 331 } // namespace media |
| OLD | NEW |