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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // all the examples in the MHTML spec - RFC 2557. | 152 // all the examples in the MHTML spec - RFC 2557. |
153 String boundary = String::fromUTF8("boundary-example"); | 153 String boundary = String::fromUTF8("boundary-example"); |
154 | 154 |
155 RefPtr<RawData> mhtmlData = RawData::create(); | 155 RefPtr<RawData> mhtmlData = RawData::create(); |
156 MHTMLArchive::generateMHTMLHeader(boundary, title, mimeType, | 156 MHTMLArchive::generateMHTMLHeader(boundary, title, mimeType, |
157 *mhtmlData->mutableData()); | 157 *mhtmlData->mutableData()); |
158 for (const auto& resource : resources) { | 158 for (const auto& resource : resources) { |
159 MHTMLArchive::generateMHTMLPart(boundary, String(), encodingPolicy, | 159 MHTMLArchive::generateMHTMLPart(boundary, String(), encodingPolicy, |
160 resource, *mhtmlData->mutableData()); | 160 resource, *mhtmlData->mutableData()); |
161 } | 161 } |
162 MHTMLArchive::generateMHTMLFooter(boundary, *mhtmlData->mutableData()); | 162 MHTMLArchive::generateMHTMLFooterForTesting(boundary, |
| 163 *mhtmlData->mutableData()); |
163 return mhtmlData.release(); | 164 return mhtmlData.release(); |
164 } | 165 } |
165 | 166 |
166 PassRefPtr<RawData> serialize(const char* title, | 167 PassRefPtr<RawData> serialize(const char* title, |
167 const char* mime, | 168 const char* mime, |
168 MHTMLArchive::EncodingPolicy encodingPolicy) { | 169 MHTMLArchive::EncodingPolicy encodingPolicy) { |
169 return generateMHTMLData(m_resources, encodingPolicy, title, mime); | 170 return generateMHTMLData(m_resources, encodingPolicy, title, mime); |
170 } | 171 } |
171 | 172 |
172 private: | 173 private: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Full sandboxing should be turned on. | 279 // Full sandboxing should be turned on. |
279 EXPECT_TRUE(document->isSandboxed(SandboxAll)); | 280 EXPECT_TRUE(document->isSandboxed(SandboxAll)); |
280 | 281 |
281 // MHTML document should be loaded into unique origin. | 282 // MHTML document should be loaded into unique origin. |
282 EXPECT_TRUE(document->getSecurityOrigin()->isUnique()); | 283 EXPECT_TRUE(document->getSecurityOrigin()->isUnique()); |
283 // Script execution should be disabled. | 284 // Script execution should be disabled. |
284 EXPECT_FALSE(document->canExecuteScripts(NotAboutToExecuteScript)); | 285 EXPECT_FALSE(document->canExecuteScripts(NotAboutToExecuteScript)); |
285 } | 286 } |
286 | 287 |
287 } // namespace blink | 288 } // namespace blink |
OLD | NEW |