| Index: chrome/browser/download/save_page_browsertest.cc
|
| diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc
|
| index 6bd94ca14d58794d9d23d67e680f4f2d682f1565..7ae7eb5ff6031cad0a1f683d2b2c001f97a560f7 100644
|
| --- a/chrome/browser/download/save_page_browsertest.cc
|
| +++ b/chrome/browser/download/save_page_browsertest.cc
|
| @@ -973,16 +973,28 @@ class SavePageMultiFrameBrowserTest
|
| nullptr, nullptr);
|
|
|
| EXPECT_EQ(1, actual_number_of_matches)
|
| - << "Verifying if \"" << expected_substring << "\" appears "
|
| - << "exactly once in the web-contents text";
|
| + << "Verifying that \"" << expected_substring << "\" appears "
|
| + << "exactly once in the text of web contents";
|
| }
|
|
|
| - int actual_number_of_errors = ui_test_utils::FindInPage(
|
| - GetCurrentTab(browser()), base::UTF8ToUTF16("err"),
|
| - true, // |forward|
|
| - false, // |case_sensitive|
|
| - nullptr, nullptr);
|
| - EXPECT_EQ(0, actual_number_of_errors);
|
| + std::vector<std::string> forbidden_substrings{
|
| + "head" // Html markup should not render.
|
| + "err", // Used in error messages + included as text content
|
| + // of <object> elements (in case the object itself doesn't
|
| + // render).
|
| + };
|
| +
|
| + for (const auto& forbidden_substring : forbidden_substrings) {
|
| + int actual_number_of_matches = ui_test_utils::FindInPage(
|
| + GetCurrentTab(browser()), base::UTF8ToUTF16(forbidden_substring),
|
| + true, // |forward|
|
| + true, // |case_sensitive|
|
| + nullptr, nullptr);
|
| +
|
| + EXPECT_EQ(0, actual_number_of_matches)
|
| + << "Verifying that \"" << forbidden_substring << "\" doesn't "
|
| + << "appear in the text of web contents";
|
| + }
|
| }
|
|
|
| static void IncrementInteger(int* i, content::RenderFrameHost* /* unused */) {
|
| @@ -1076,6 +1088,34 @@ IN_PROC_BROWSER_TEST_P(SavePageMultiFrameBrowserTest, NestedFrames) {
|
| TestMultiFramePage(save_page_type, url, 3, expected_substrings);
|
| }
|
|
|
| +// Test for saving frames with various encodings (crbug.com/541699).
|
| +// - iso-8859-2: single-byte encoding, encoding declared via <meta> element
|
| +// - utf32.htm - multi-byte encoding, detection via mocked http headers
|
| +// - euc-kr.htm - encoding via html entities
|
| +IN_PROC_BROWSER_TEST_P(SavePageMultiFrameBrowserTest, Encoding) {
|
| + content::SavePageType save_page_type = GetParam();
|
| +
|
| + std::vector<std::string> expected_substrings{
|
| + "frames-encodings.htm: f53295dd-a95b-4b32-85f5-b6e15377fb20",
|
| + "euc-kr.htm: 樂樂",
|
| + "iso-8859-2.htm: Zażółć gęślą jaźń",
|
| + "utf32.htm: Zażółć gęślą jaźń",
|
| + };
|
| +
|
| + GURL url(embedded_test_server()->GetURL("a.com",
|
| + "/save_page/frames-encodings.htm"));
|
| +
|
| + // TODO(lukasza): crbug.com/541699: MHTML needs to handle multi-byte encodings
|
| + // by either:
|
| + // 1. Continuing to preserve the original encoding, but starting to round-trip
|
| + // the encoding declaration (in Content-Type MIME/MHTML header?)
|
| + // 2. Saving html docs in UTF8.
|
| + if (save_page_type == content::SAVE_PAGE_TYPE_AS_MHTML)
|
| + return;
|
| +
|
| + TestMultiFramePage(save_page_type, url, 4, expected_substrings);
|
| +}
|
| +
|
| INSTANTIATE_TEST_CASE_P(
|
| ,
|
| SavePageMultiFrameBrowserTest,
|
|
|