OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 8 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
9 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 content_range_lower_bound = 0; | 596 content_range_lower_bound = 0; |
597 content_range_upper_bound = 0; | 597 content_range_upper_bound = 0; |
598 | 598 |
599 result = MultipartResponseDelegate::ReadContentRanges( | 599 result = MultipartResponseDelegate::ReadContentRanges( |
600 response4, &content_range_lower_bound, | 600 response4, &content_range_lower_bound, |
601 &content_range_upper_bound); | 601 &content_range_upper_bound); |
602 | 602 |
603 EXPECT_EQ(result, false); | 603 EXPECT_EQ(result, false); |
604 } | 604 } |
605 | 605 |
| 606 TEST(MultipartResponseTest, MultipartPayloadSet) { |
| 607 WebURLResponse response; |
| 608 response.initialize(); |
| 609 response.setMIMEType(WebString::fromUTF8("multipart/x-mixed-replace")); |
| 610 MockWebURLLoaderClient client; |
| 611 MultipartResponseDelegate delegate(&client, NULL, response, "bound"); |
| 612 |
| 613 string data( |
| 614 "--bound\n" |
| 615 "Content-type: text/plain\n\n" |
| 616 "response data\n" |
| 617 "--bound\n"); |
| 618 delegate.OnReceivedData(data.c_str(), static_cast<int>(data.length())); |
| 619 EXPECT_EQ(1, |
| 620 client.received_response_); |
| 621 EXPECT_EQ(string("response data\n"), |
| 622 client.data_); |
| 623 EXPECT_EQ(false, client.response_.isMultipartPayload()); |
| 624 |
| 625 string data2( |
| 626 "Content-type: text/plain\n\n" |
| 627 "response data2\n" |
| 628 "--bound\n"); |
| 629 delegate.OnReceivedData(data2.c_str(), static_cast<int>(data2.length())); |
| 630 EXPECT_EQ(2, |
| 631 client.received_response_); |
| 632 EXPECT_EQ(string("response data2\n"), |
| 633 client.data_); |
| 634 EXPECT_EQ(true, client.response_.isMultipartPayload()); |
| 635 } |
| 636 |
606 } // namespace | 637 } // namespace |
OLD | NEW |