Commit 261b4132 authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

[quickview] Add test for display of MHTML files

Bug: 960277
Tests: browser_tests --gtest_filter="*openQuickViewMhtml*"
Change-Id: I8be8483e6b5dd6e3e99701bfc14551262c782090
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131822Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756052}
parent 2058fef8
...@@ -499,6 +499,7 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( ...@@ -499,6 +499,7 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("openQuickViewSniffedText"), TestCase("openQuickViewSniffedText"),
TestCase("openQuickViewScrollText"), TestCase("openQuickViewScrollText"),
TestCase("openQuickViewScrollHtml"), TestCase("openQuickViewScrollHtml"),
TestCase("openQuickViewMhtml"),
TestCase("openQuickViewBackgroundColorHtml"), TestCase("openQuickViewBackgroundColorHtml"),
TestCase("openQuickViewDrive"), TestCase("openQuickViewDrive"),
TestCase("openQuickViewSmbfs").EnableSmbfs(), TestCase("openQuickViewSmbfs").EnableSmbfs(),
......
From: <Saved by Blink>
Subject:
Date: Fri, 24 May 2019 00:27:44 -0000
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----MultipartBoundary--VKh1aJ3tgkQhPUVQ6JkAhXAQyIRNSPLAzGo7YI6gjP----"
------MultipartBoundary--VKh1aJ3tgkQhPUVQ6JkAhXAQyIRNSPLAzGo7YI6gjP----
Content-Type: text/plain
Hello World
------MultipartBoundary--VKh1aJ3tgkQhPUVQ6JkAhXAQyIRNSPLAzGo7YI6gjP------
...@@ -725,6 +725,42 @@ ...@@ -725,6 +725,42 @@
chrome.test.assertEq('application/pdf', mimeType); chrome.test.assertEq('application/pdf', mimeType);
}; };
/**
* Tests opening Quick View with a '.mhtml' filename extension.
*/
testcase.openQuickViewMhtml = async () => {
const caller = getCaller();
/**
* The text <webview> resides in the #quick-view shadow DOM, as a child of
* the #dialog element.
*/
const webView = ['#quick-view', 'files-safe-media[type="html"]', 'webview'];
// Open Files app on Downloads containing ENTRIES.plainText.
const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.mHtml], []);
// Open the file in Quick View.
await openQuickView(appId, ENTRIES.mHtml.nameText);
// Wait for the Quick View <webview> to load and display its content.
function checkWebViewTextLoaded(elements) {
let haveElements = Array.isArray(elements) && elements.length === 1;
if (haveElements) {
haveElements = elements[0].styles.display.includes('block');
}
if (!haveElements || !elements[0].attributes.src) {
return pending(caller, 'Waiting for <webview> to load.');
}
return;
}
await repeatUntil(async () => {
return checkWebViewTextLoaded(await remoteCall.callRemoteTestUtil(
'deepQueryAllElements', appId, [webView, ['display']]));
});
};
/** /**
* Tests opening Quick View and scrolling its <webview> which contains a tall * Tests opening Quick View and scrolling its <webview> which contains a tall
* html document. * html document.
......
...@@ -712,6 +712,17 @@ const ENTRIES = { ...@@ -712,6 +712,17 @@ const ENTRIES = {
typeText: 'Plain text', typeText: 'Plain text',
}), }),
mHtml: new TestEntryInfo({
type: EntryType.FILE,
sourceFileName: 'page.mhtml',
targetPath: 'page.mhtml',
mimeType: 'multipart/related',
lastModifiedTime: 'Sep 4, 1998, 12:34 PM',
nameText: 'page.mhtml',
sizeText: '421 bytes',
typeText: 'HTML document',
}),
tallHtml: new TestEntryInfo({ tallHtml: new TestEntryInfo({
type: EntryType.FILE, type: EntryType.FILE,
sourceFileName: 'tall.html', sourceFileName: 'tall.html',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment