Skip to content

Commit

Permalink
[ MimeHandlerView ] Fix TemporaryAdressSpoof with the flag
Browse files Browse the repository at this point in the history
With MimeHandlerViewInCrossProcessFrame the input should directly be
routed to the guest WebContents and not the embedder.

Bug: 961786
Change-Id: Ie44d09e7412d56686212c68f94ad7ded64c23258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1615488
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660584}
  • Loading branch information
ehsan-karamad authored and Commit Bot committed May 16, 2019
1 parent ff6af6b commit 853d06f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion chrome/browser/extensions/api/tabs/tabs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/mime_handler_view_mode.h"
#include "content/public/common/page_zoom.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
Expand Down Expand Up @@ -2087,10 +2088,18 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TemporaryAddressSpoof) {
pdf_extension_test_util::EnsurePDFHasLoaded(second_web_contents);
EXPECT_TRUE(load_success);

auto* web_contents_for_click = second_web_contents;
if (content::MimeHandlerViewMode::UsesCrossProcessFrame()) {
auto inner_web_contents = web_contents_for_click->GetInnerWebContents();
ASSERT_EQ(1U, inner_web_contents.size());
// With MimeHandlerViewInCrossProcessFrame input should directly route to
// the guest WebContents as there is no longer a BrowserPlugin involved.
web_contents_for_click = inner_web_contents[0];
}
// The actual PDF page coordinates that this click goes to is (346, 333),
// after several space transformations, not (400, 400). This clicks on a link
// to "http://www.facebook.com:83".
content::SimulateMouseClickAt(second_web_contents, 0,
content::SimulateMouseClickAt(web_contents_for_click, 0,
blink::WebMouseEvent::Button::kLeft,
gfx::Point(400, 400));

Expand Down

0 comments on commit 853d06f

Please sign in to comment.