| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 addResource("http://www.test.com/purple_background.png", "image/png", "p
urple_background.png"); | 138 addResource("http://www.test.com/purple_background.png", "image/png", "p
urple_background.png"); |
| 139 addResource("http://www.test.com/ul-dot.png", "image/png", "ul-dot.png")
; | 139 addResource("http://www.test.com/ul-dot.png", "image/png", "ul-dot.png")
; |
| 140 addResource("http://www.test.com/ol-dot.png", "image/png", "ol-dot.png")
; | 140 addResource("http://www.test.com/ol-dot.png", "image/png", "ol-dot.png")
; |
| 141 } | 141 } |
| 142 | 142 |
| 143 static PassRefPtr<SharedBuffer> generateMHTMLData( | 143 static PassRefPtr<SharedBuffer> generateMHTMLData( |
| 144 const Vector<SerializedResource>& resources, | 144 const Vector<SerializedResource>& resources, |
| 145 MHTMLArchive::EncodingPolicy encodingPolicy, | 145 MHTMLArchive::EncodingPolicy encodingPolicy, |
| 146 const String& title, const String& mimeType) | 146 const String& title, const String& mimeType) |
| 147 { | 147 { |
| 148 String boundary = MHTMLArchive::generateMHTMLBoundary(); | 148 // This boundary is as good as any other. Plus it gets used in almost |
| 149 // all the examples in the MHTML spec - RFC 2557. |
| 150 String boundary = String::fromUTF8("boundary-example"); |
| 149 | 151 |
| 150 RefPtr<SharedBuffer> mhtmlData = SharedBuffer::create(); | 152 RefPtr<SharedBuffer> mhtmlData = SharedBuffer::create(); |
| 151 MHTMLArchive::generateMHTMLHeader(boundary, title, mimeType, *mhtmlData)
; | 153 MHTMLArchive::generateMHTMLHeader(boundary, title, mimeType, *mhtmlData)
; |
| 152 for (const auto& resource : resources) { | 154 for (const auto& resource : resources) { |
| 153 MHTMLArchive::generateMHTMLPart( | 155 MHTMLArchive::generateMHTMLPart( |
| 154 boundary, String(), encodingPolicy, resource, *mhtmlData); | 156 boundary, String(), encodingPolicy, resource, *mhtmlData); |
| 155 } | 157 } |
| 156 MHTMLArchive::generateMHTMLFooter(boundary, *mhtmlData); | 158 MHTMLArchive::generateMHTMLFooter(boundary, *mhtmlData); |
| 157 return mhtmlData.release(); | 159 return mhtmlData.release(); |
| 158 } | 160 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 ASSERT_TRUE(expectedEncoding); | 227 ASSERT_TRUE(expectedEncoding); |
| 226 EXPECT_NE(line.find(expectedEncoding), std::string::npos); | 228 EXPECT_NE(line.find(expectedEncoding), std::string::npos); |
| 227 expectedEncoding = 0; | 229 expectedEncoding = 0; |
| 228 sectionCheckedCount++; | 230 sectionCheckedCount++; |
| 229 } | 231 } |
| 230 } | 232 } |
| 231 EXPECT_EQ(12, sectionCheckedCount); | 233 EXPECT_EQ(12, sectionCheckedCount); |
| 232 } | 234 } |
| 233 | 235 |
| 234 } // namespace blink | 236 } // namespace blink |
| OLD | NEW |