| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 static PassRefPtr<RawData> GenerateMHTMLData( | 146 static PassRefPtr<RawData> GenerateMHTMLData( |
| 147 const Vector<SerializedResource>& resources, | 147 const Vector<SerializedResource>& resources, |
| 148 MHTMLArchive::EncodingPolicy encoding_policy, | 148 MHTMLArchive::EncodingPolicy encoding_policy, |
| 149 const String& title, | 149 const String& title, |
| 150 const String& mime_type) { | 150 const String& mime_type) { |
| 151 // This boundary is as good as any other. Plus it gets used in almost | 151 // This boundary is as good as any other. Plus it gets used in almost |
| 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> mhtml_data = RawData::Create(); | 155 RefPtr<RawData> mhtml_data = RawData::Create(); |
| 156 MHTMLArchive::GenerateMHTMLHeader(boundary, title, mime_type, | 156 MHTMLArchive::GenerateMHTMLHeaderForTesting(boundary, title, mime_type, |
| 157 *mhtml_data->MutableData()); | 157 *mhtml_data->MutableData()); |
| 158 for (const auto& resource : resources) { | 158 for (const auto& resource : resources) { |
| 159 MHTMLArchive::GenerateMHTMLPart(boundary, String(), encoding_policy, | 159 MHTMLArchive::GenerateMHTMLPart(boundary, String(), encoding_policy, |
| 160 resource, *mhtml_data->MutableData()); | 160 resource, *mhtml_data->MutableData()); |
| 161 } | 161 } |
| 162 MHTMLArchive::GenerateMHTMLFooterForTesting(boundary, | 162 MHTMLArchive::GenerateMHTMLFooterForTesting(boundary, |
| 163 *mhtml_data->MutableData()); | 163 *mhtml_data->MutableData()); |
| 164 return mhtml_data.Release(); | 164 return mhtml_data.Release(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 PassRefPtr<RawData> Serialize(const char* title, | 167 PassRefPtr<RawData> Serialize(const char* title, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Full sandboxing should be turned on. | 279 // Full sandboxing should be turned on. |
| 280 EXPECT_TRUE(document->IsSandboxed(kSandboxAll)); | 280 EXPECT_TRUE(document->IsSandboxed(kSandboxAll)); |
| 281 | 281 |
| 282 // MHTML document should be loaded into unique origin. | 282 // MHTML document should be loaded into unique origin. |
| 283 EXPECT_TRUE(document->GetSecurityOrigin()->IsUnique()); | 283 EXPECT_TRUE(document->GetSecurityOrigin()->IsUnique()); |
| 284 // Script execution should be disabled. | 284 // Script execution should be disabled. |
| 285 EXPECT_FALSE(document->CanExecuteScripts(kNotAboutToExecuteScript)); | 285 EXPECT_FALSE(document->CanExecuteScripts(kNotAboutToExecuteScript)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace blink | 288 } // namespace blink |
| OLD | NEW |