Commit 98ee1b09 authored by EhsanK's avatar EhsanK Committed by Commit Bot

Add test for a recent regression in PDF Viewer on slides pages

Adding a test for https://crrev.com/502847.

Bug: 766982, 763812
Change-Id: I23bd8d27cb2b83ee527f12a9103f82e8eac0b115
Reviewed-on: https://chromium-review.googlesource.com/682597
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504473}
parent 012a9764
......@@ -1311,6 +1311,20 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionClipboardTest, CombinedShiftArrowPresses) {
SendCopyCommandAndCheckCopyPasteClipboard("L");
}
// Verifies that an <embed> of size zero will still instantiate a guest and post
// message to the <embed> is correctly forwarded to the extension. This is for
// catching future regression in docs/ and slides/ pages (see
// https://crbug.com/763812).
IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PostMessageForZeroSizedEmbed) {
content::DOMMessageQueue queue;
GURL url(embedded_test_server()->GetURL(
"/pdf/post_message_zero_sized_embed.html"));
ui_test_utils::NavigateToURL(browser(), url);
std::string message;
EXPECT_TRUE(queue.WaitForMessage(&message));
EXPECT_EQ("\"POST_MESSAGE_OK\"", message);
}
#if defined(OS_MACOSX)
// Test that "smart zoom" (double-tap with two fingers on Mac trackpad)
// is disabled for the PDF viewer. This prevents the viewer's controls from
......
<html>
<body>
<script>
/*
This test page will attach an <embed> of size 0x0 and posts message to it to
verify that the BrowserPlugin and MimeHandlerViewContainer are created and
the extension properly loaded. This is for a regression in slides/ pages where
post messaging to <embed> should pop up print preview (only on Chrome). For
for context see https://crbug.com/763812.
*/
window.addEventListener('load', attachPdfAndPostMessage);
window.addEventListener('message', onMessageReceived);
function attachPdfAndPostMessage() {
var e = document.createElement('embed');
e.style.width = '0px';
e.style.height = '0px';
e.type = 'application/pdf';
e.src = 'test.pdf';
document.body.appendChild(e);
e.postMessage({type: 'getSelectedText'});
}
function onMessageReceived(msg) {
if (msg.data.type && msg.data.type === 'getSelectedTextReply')
window.domAutomationController.send('POST_MESSAGE_OK');
}
</script>
</body>
</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