summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorlukasza <lukasza@chromium.org>2015-11-12 11:00:25 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-12 19:01:16 +0000
commit4771dd55cdc2ca26c955776056d540ec62da40e6 (patch)
tree183c079a9da300e8a13dc759d78fa95ede7cd2cf /content
parent3aeeedfb769904f6f5ae233d44731595eef1e295 (diff)
downloadchromium_src-4771dd55cdc2ca26c955776056d540ec62da40e6.zip
chromium_src-4771dd55cdc2ca26c955776056d540ec62da40e6.tar.gz
chromium_src-4771dd55cdc2ca26c955776056d540ec62da40e6.tar.bz2
Tests comparing original-vs-saved for multi-frame pages.
Extra tests navigate to the saved file and verify if it "looks" the same as the original page (i.e. if it has the same number of frames, if it has the expected substrings from all subframes, if it has no "err" substrings). The extra verification done by the new test catches some regressions that older tests would not catch (i.e. without the new tests verifying about:blank regressions is tricky, as substrings for subframes can appear in the saved file but end up not being rendered because of incorrect cross-referencing). Additionally the extra verification adds coverage for newly discovered bugs (i.e. for handling of <object> elements). More details about the changes: - The new resources got created manually from scratch: pdf.pdf and svg.svg using Inkscape, png.png using Gimp. - iframes.htm got renamed to frames-xsite.htm (to be named consistently with the other 2 test files in this CL). - local-about-blank-subframes.htm got renamed to frames-about-blank.htm and moved from content/test/data/download into chrome/test/data/save_page/ The test using this file in mhtml_generation_browsertest.cc got removed - the coverage offered by one of the new tests (SavePageMultiFrameBrowserTest.AboutBlank_MHTML) is a superset of the coverage from the old test. - Content verification markers got tweaked so the tests are easier to read (i.e. it is more apparent which htm test file the given guid comes from). - The SavePageMultiFrameBrowserTest to some extent overlap coverage of existing SavePageSitePerProcessBrowserTest. This is ok, as the old and new tests still verify some things unique to a specific test. - In theory we could reuse SavePageSitePerProcessBrowserTest class. I've put the new tests into a separate SavePageMultiFrameBrowserTest class, because all new tests perform the same steps and verification and I plan to parametrize SavePageMultiFrameBrowserTest in the future by having it inherit from ::testing::WithParamInterface<SavePageType>. BUG=553478, 539936, 538766, 526786 Review URL: https://codereview.chromium.org/1412733017 Cr-Commit-Position: refs/heads/master@{#359351}
Diffstat (limited to 'content')
-rw-r--r--content/browser/download/mhtml_generation_browsertest.cc34
-rw-r--r--content/test/data/download/local-about-blank-subframes.html39
2 files changed, 0 insertions, 73 deletions
diff --git a/content/browser/download/mhtml_generation_browsertest.cc b/content/browser/download/mhtml_generation_browsertest.cc
index 8bffabb..6ade20f 100644
--- a/content/browser/download/mhtml_generation_browsertest.cc
+++ b/content/browser/download/mhtml_generation_browsertest.cc
@@ -83,40 +83,6 @@ IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) {
EXPECT_GT(file_size, 100); // Verify the actual file size.
}
-// This test verifies how MHTML serialization handles frames that have
-// the same URI (especially about:blank URI) but different content.
-// It should preserve contents of all the frames.
-IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, LocalAboutBlankSubframes) {
- base::FilePath path(temp_dir_.path());
- path = path.Append(FILE_PATH_LITERAL("test-local-about-blank-subframes.mht"));
-
- GenerateMHTML(path, embedded_test_server()->GetURL(
- "/download/local-about-blank-subframes.html"));
- ASSERT_FALSE(HasFailure());
-
- std::string mhtml;
- ASSERT_TRUE(base::ReadFileToString(path, &mhtml));
-
- // Make sure the contents of all frames are present.
- // 1. Check for contents (this is insufficient as it can also hit the contents
- // in the iframe.srcdoc attribute).
- EXPECT_THAT(mhtml, HasSubstr("main: acb0609d-eb10-4c26-83e2-ad8afb7b0ff3"));
- EXPECT_THAT(mhtml, HasSubstr("sub1: b124df3a-d39f-47a1-ae04-5bb5d0bf549e"));
- EXPECT_THAT(mhtml, HasSubstr("sub2: 07014068-604d-45ae-884f-a068cfe7bc0a"));
- EXPECT_THAT(mhtml, HasSubstr("sub3: 06cc8fcc-c692-4a1a-a10f-1645b746e8f4"));
- // 2. Count the number of text/html mhtml parts.
- int count = 0;
- size_t pos = 0;
- for (;;) {
- pos = mhtml.find("Content-Type: text/html", pos);
- if (pos == std::string::npos)
- break;
- count++;
- pos++;
- }
- EXPECT_EQ(4, count) << "Verify number of text/html parts in the mhtml output";
-}
-
IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, InvalidPath) {
base::FilePath path(FILE_PATH_LITERAL("/invalid/file/path"));
diff --git a/content/test/data/download/local-about-blank-subframes.html b/content/test/data/download/local-about-blank-subframes.html
deleted file mode 100644
index 01231d0..0000000
--- a/content/test/data/download/local-about-blank-subframes.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<html>
- <head>
- <title>Inline iframes test</title>
- </head>
- <body>
- main: acb0609d-eb10-4c26-83e2-ad8afb7b0ff3 <br/>
-
- <iframe srcdoc="
- &lt;html&gt;
- &lt;head&gt;
- &lt;title&gt;subtitle1&lt;/title&gt;
- &lt;/head&gt;
- &lt;body&gt;
- sub1: b124df3a-d39f-47a1-ae04-5bb5d0bf549e
- &lt;/body&gt;
- &lt;/html&gt;"></iframe> <br/>
-
- <iframe srcdoc="
- &lt;html&gt;
- &lt;head&gt;
- &lt;title&gt;subtitle2&lt;/title&gt;
- &lt;/head&gt;
- &lt;body&gt;
- sub2: 07014068-604d-45ae-884f-a068cfe7bc0a
- &lt;/body&gt;
- &lt;/html&gt;"></iframe> <br/>
-
- <iframe srcdoc="
- &lt;html&gt;
- &lt;head&gt;
- &lt;title&gt;subtitle3&lt;/title&gt;
- &lt;/head&gt;
- &lt;body&gt;
- sub3: 06cc8fcc-c692-4a1a-a10f-1645b746e8f4
- &lt;/body&gt;
- &lt;/html&gt;"></iframe> <br/>
-
- </body>
-</html>