OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/multipart_response_delegate.h" | 5 #include "content/child/multipart_response_delegate.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <vector> | 10 #include <vector> |
8 | 11 |
| 12 #include "base/macros.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/WebKit/public/platform/WebString.h" | 14 #include "third_party/WebKit/public/platform/WebString.h" |
11 #include "third_party/WebKit/public/platform/WebURL.h" | 15 #include "third_party/WebKit/public/platform/WebURL.h" |
12 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 16 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
13 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 17 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
14 | 18 |
15 using blink::WebString; | 19 using blink::WebString; |
16 using blink::WebURL; | 20 using blink::WebURL; |
17 using blink::WebURLError; | 21 using blink::WebURLError; |
18 using blink::WebURLLoader; | 22 using blink::WebURLLoader; |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 567 |
564 TEST(MultipartResponseTest, MultipartContentRangesTest) { | 568 TEST(MultipartResponseTest, MultipartContentRangesTest) { |
565 WebURLResponse response1; | 569 WebURLResponse response1; |
566 response1.initialize(); | 570 response1.initialize(); |
567 response1.setMIMEType("application/pdf"); | 571 response1.setMIMEType("application/pdf"); |
568 response1.setHTTPHeaderField("Content-Length", "200"); // Ignored! | 572 response1.setHTTPHeaderField("Content-Length", "200"); // Ignored! |
569 // Use intentionally >32bit values to check they are handled correctly. | 573 // Use intentionally >32bit values to check they are handled correctly. |
570 response1.setHTTPHeaderField("Content-Range", | 574 response1.setHTTPHeaderField("Content-Range", |
571 "bytes 5000000000-5000000050/6000000000"); | 575 "bytes 5000000000-5000000050/6000000000"); |
572 | 576 |
573 int64 content_range_lower_bound = 0; | 577 int64_t content_range_lower_bound = 0; |
574 int64 content_range_upper_bound = 0; | 578 int64_t content_range_upper_bound = 0; |
575 int64 content_range_instance_size = 0; | 579 int64_t content_range_instance_size = 0; |
576 | 580 |
577 bool result = MultipartResponseDelegate::ReadContentRanges( | 581 bool result = MultipartResponseDelegate::ReadContentRanges( |
578 response1, &content_range_lower_bound, | 582 response1, &content_range_lower_bound, |
579 &content_range_upper_bound, | 583 &content_range_upper_bound, |
580 &content_range_instance_size); | 584 &content_range_instance_size); |
581 | 585 |
582 EXPECT_EQ(result, true); | 586 EXPECT_EQ(result, true); |
583 EXPECT_EQ(content_range_lower_bound, 5e9); | 587 EXPECT_EQ(content_range_lower_bound, 5e9); |
584 EXPECT_EQ(content_range_upper_bound, 5e9+50); | 588 EXPECT_EQ(content_range_upper_bound, 5e9+50); |
585 EXPECT_EQ(content_range_instance_size, 6e9); | 589 EXPECT_EQ(content_range_instance_size, 6e9); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 EXPECT_EQ(2, client.received_response_); | 671 EXPECT_EQ(2, client.received_response_); |
668 EXPECT_EQ(string("response data2"), client.data_); | 672 EXPECT_EQ(string("response data2"), client.data_); |
669 EXPECT_EQ(static_cast<int>(data.length()) + static_cast<int>(data2.length()), | 673 EXPECT_EQ(static_cast<int>(data.length()) + static_cast<int>(data2.length()), |
670 client.total_encoded_data_length_); | 674 client.total_encoded_data_length_); |
671 EXPECT_TRUE(client.response_.isMultipartPayload()); | 675 EXPECT_TRUE(client.response_.isMultipartPayload()); |
672 } | 676 } |
673 | 677 |
674 } // namespace | 678 } // namespace |
675 | 679 |
676 } // namespace content | 680 } // namespace content |
OLD | NEW |