Index: content/browser/download/mhtml_generation_browsertest.cc |
diff --git a/content/browser/download/mhtml_generation_browsertest.cc b/content/browser/download/mhtml_generation_browsertest.cc |
index 00f3aeb1964ce93c82c864ee176517fb083ec02c..6b28397c13ce3408492b12d0f23196b803970401 100644 |
--- a/content/browser/download/mhtml_generation_browsertest.cc |
+++ b/content/browser/download/mhtml_generation_browsertest.cc |
@@ -199,6 +199,51 @@ IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTMLObeyNoStoreMainFrame) { |
EXPECT_THAT(mhtml, Not(HasSubstr("test body"))); |
} |
+IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, |
+ GenerateMHTMLIgnoreNoStoreSubFrame) { |
+ base::FilePath path(temp_dir_.path()); |
+ path = path.Append(FILE_PATH_LITERAL("test.mht")); |
+ |
+ GURL url(embedded_test_server()->GetURL("/contains_nostore_iframe.html")); |
+ |
+ // Generate MHTML, specifying the FAIL_FOR_NO_STORE_MAIN_FRAME policy. |
+ MHTMLGenerationParams params(path); |
+ params.cache_control_policy = |
+ content::MHTMLCacheControlPolicy::FAIL_FOR_NO_STORE_MAIN_FRAME; |
+ |
+ GenerateMHTML(params, url); |
+ // We expect that there was no error (file size -1 indicates an error.) |
+ EXPECT_LT(0, file_size()); |
+ |
+ std::string mhtml; |
+ ASSERT_TRUE(base::ReadFileToString(path, &mhtml)); |
+ |
+ // Make sure that no-store subresources exist in this mode. |
+ EXPECT_THAT(mhtml, HasSubstr("no-store test body")); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTMLObeyNoStoreSubFrame) { |
+ base::FilePath path(temp_dir_.path()); |
+ path = path.Append(FILE_PATH_LITERAL("test.mht")); |
+ |
+ GURL url(embedded_test_server()->GetURL("/contains_nostore_iframe.html")); |
+ |
+ // Generate MHTML, specifying the FAIL_FOR_NO_STORE_MAIN_FRAME policy. |
+ MHTMLGenerationParams params(path); |
+ params.cache_control_policy = content::MHTMLCacheControlPolicy:: |
+ SKIP_ANY_FRAME_OR_RESOURCE_MARKED_NO_STORE; |
+ |
+ GenerateMHTML(params, url); |
+ // We expect that there was no error (file size -1 indicates an error.) |
+ EXPECT_LT(0, file_size()); |
+ |
+ std::string mhtml; |
+ ASSERT_TRUE(base::ReadFileToString(path, &mhtml)); |
+ |
+ // Make sure the contents are missing. |
+ EXPECT_THAT(mhtml, Not(HasSubstr("no-store test body"))); |
+} |
+ |
Dmitry Titov
2016/05/18 00:18:47
it'd be nice to add a subresource test (css or ima
dewittj
2016/05/19 04:13:17
Done.
Note that CSS is not covered by this CL (I
|
// Test suite that allows testing --site-per-process against cross-site frames. |
// See http://dev.chromium.org/developers/design-documents/site-isolation. |
class MHTMLGenerationSitePerProcessTest : public MHTMLGenerationTest { |