Commit bb2af90d authored by Ehsan Karamad's avatar Ehsan Karamad Committed by Commit Bot

[ MimeHandlerView ] Add more expectation to a test

This is a followup to https://crrev.com/c/1614282 which adds more
expectations to verify the contents of sandboxed <iframe>s and ensures
the documents are empty.

Bug: 963641
Change-Id: I5106aff83c25b3f9e0d5a6239ef24f8351529530
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637218Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664841}
parent 524a486f
<html>
<body>
<object id="plugin" width="200" height="200" data="testEmbedded.csv" type="text/csv"></object>
<object id="plugin" width="200" height="200" data="testEmbedded.csv" type="text/csv">
<!-- fallback used for sandbox test -->
<div id="fallback">Fallback</div>
</object>
</body>
</html>
<!doctype html>
<iframe id="sandbox1" sandbox src="testEmbedded.csv"></iframe>
<iframe id="sandbox2" sandbox src="test_embedded.html"></iframe>
<iframe id="sandbox1" src="testEmbedded.csv"
sandbox="allow-scripts allow-same-origin"></iframe>
<iframe id="sandbox2" src="test_embedded.html"
sandbox="allow-scripts allow-same-origin"></iframe>
<iframe id="notsandboxed" src="testEmbedded.csv"></iframe>
<script>
function remove_frame(id) {
......
......@@ -670,4 +670,21 @@ IN_PROC_BROWSER_TEST_P(MimeHandlerViewCrossProcessTest,
// The page is expected to embed only '1' GuestView. If there is GuestViews
// embedded inside other frames we should be timing out here.
guest_view_manager->WaitForAllGuestsDeleted();
// Sanity check: Ensure that the documents in a sandbox frame is empty.
auto sandbox1_document_has_contents =
content::EvalJs(GetEmbedderWebContents(),
"!!(sandbox1.contentDocument.body && "
"sandbox1.contentDocument.body.firstChild)")
.ExtractBool();
EXPECT_FALSE(sandbox1_document_has_contents);
// The document inside 'sandbox2' contains an <object> with fallback content.
// The expectation is that the <object> fails to load the MimeHandlerView and
// should show the fallback content instead, which means the width of the
// layout object is non-zero.
auto fallback_width =
content::EvalJs(GetEmbedderWebContents(),
"sandbox2.contentDocument.getElementById('fallback')."
"getBoundingClientRect().width")
.ExtractInt();
EXPECT_NE(0, fallback_width);
}
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