Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: media/blink/multibuffer_data_source_unittest.cc

Issue 2455693004: Media: fail properly on 404 after redirect (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/blink/resource_multibuffer_data_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 blink::WebURLRequest request((GURL(kHttpDifferentPathUrl))); 1424 blink::WebURLRequest request((GURL(kHttpDifferentPathUrl)));
1425 blink::WebURLResponse response((GURL(kHttpUrl))); 1425 blink::WebURLResponse response((GURL(kHttpUrl)));
1426 response.setHTTPStatusCode(307); 1426 response.setHTTPStatusCode(307);
1427 data_provider()->willFollowRedirect(request, response); 1427 data_provider()->willFollowRedirect(request, response);
1428 1428
1429 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); 1429 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
1430 Respond(response_generator_->GenerateResponse(416)); 1430 Respond(response_generator_->GenerateResponse(416));
1431 Stop(); 1431 Stop();
1432 } 1432 }
1433 1433
1434 TEST_F(MultibufferDataSourceTest, Http_404AfterRedirect) {
1435 Initialize(kHttpUrl, false);
1436
1437 // Server responds with a redirect.
1438 blink::WebURLRequest request((GURL(kHttpDifferentPathUrl)));
1439 blink::WebURLResponse response((GURL(kHttpUrl)));
1440 response.setHTTPStatusCode(307);
1441 data_provider()->willFollowRedirect(request, response);
1442
1443 Respond(response_generator_->Generate404());
1444 Stop();
1445 }
1446
1434 TEST_F(MultibufferDataSourceTest, LengthKnownAtEOF) { 1447 TEST_F(MultibufferDataSourceTest, LengthKnownAtEOF) {
1435 Initialize(kHttpUrl, true); 1448 Initialize(kHttpUrl, true);
1436 // Server responds without content-length. 1449 // Server responds without content-length.
1437 WebURLResponse response = response_generator_->Generate200(); 1450 WebURLResponse response = response_generator_->Generate200();
1438 response.clearHTTPHeaderField(WebString::fromUTF8("Content-Length")); 1451 response.clearHTTPHeaderField(WebString::fromUTF8("Content-Length"));
1439 response.setExpectedContentLength(kPositionNotSpecified); 1452 response.setExpectedContentLength(kPositionNotSpecified);
1440 Respond(response); 1453 Respond(response);
1441 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); 1454 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
1442 ReceiveData(kDataSize); 1455 ReceiveData(kDataSize);
1443 int64_t len; 1456 int64_t len;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 const std::string etag("\"arglebargle glop-glyf?\""); 1531 const std::string etag("\"arglebargle glop-glyf?\"");
1519 response.setHTTPHeaderField(WebString::fromUTF8("Etag"), 1532 response.setHTTPHeaderField(WebString::fromUTF8("Etag"),
1520 WebString::fromUTF8(etag)); 1533 WebString::fromUTF8(etag));
1521 Respond(response); 1534 Respond(response);
1522 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); 1535 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
1523 ReceiveData(kDataSize); 1536 ReceiveData(kDataSize);
1524 1537
1525 EXPECT_EQ(url_data()->etag(), etag); 1538 EXPECT_EQ(url_data()->etag(), etag);
1526 } 1539 }
1527 } // namespace media 1540 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/blink/resource_multibuffer_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698