Commit 842db5eb authored by Ehsan Karamad's avatar Ehsan Karamad Committed by Commit Bot

[ MimeHandlerView ] Adapt more tests to MHVICPF

This CL makes some more tests pass with MHVICPF. Essentially,

  * BrowserPlugin tests return early as they expect a BrowserPlugin and
  with MHVCICPF we do not create one.
  * PDFExtensionInternal* tests are changed to use direct input routing
  to the guest WebContents when the flag is on.
  * PDFExtensionTest.EmbeddedPdfGetFocus will early return when MHVICPF
  is present (this is also a BrowserPlugin related test).

Bug: 961786
Change-Id: Ib90ee540283f23dccba1b7f8abfb4ee28e06654f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611855Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660011}
parent 1a7ccea6
......@@ -1451,6 +1451,12 @@ class PDFExtensionInternalLinkClickTest : public PDFExtensionTest {
return link_position;
}
content::WebContents* GetWebContentsForInputRouting() {
return content::MimeHandlerViewMode::UsesCrossProcessFrame()
? guest_contents_
: GetActiveWebContents();
}
private:
WebContents* guest_contents_;
};
......@@ -1463,9 +1469,9 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionInternalLinkClickTest, CtrlLeft) {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());
content::SimulateMouseClickAt(web_contents, kDefaultKeyModifier,
blink::WebMouseEvent::Button::kLeft,
GetLinkPosition());
content::SimulateMouseClickAt(
GetWebContentsForInputRouting(), kDefaultKeyModifier,
blink::WebMouseEvent::Button::kLeft, GetLinkPosition());
observer.Wait();
int tab_count = browser()->tab_strip_model()->count();
......@@ -1492,7 +1498,7 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionInternalLinkClickTest, Middle) {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());
content::SimulateMouseClickAt(web_contents, 0,
content::SimulateMouseClickAt(GetWebContentsForInputRouting(), 0,
blink::WebMouseEvent::Button::kMiddle,
GetLinkPosition());
observer.Wait();
......@@ -1523,9 +1529,9 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionInternalLinkClickTest, ShiftLeft) {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_BROWSER_OPENED,
content::NotificationService::AllSources());
content::SimulateMouseClickAt(web_contents, blink::WebInputEvent::kShiftKey,
blink::WebMouseEvent::Button::kLeft,
GetLinkPosition());
content::SimulateMouseClickAt(
GetWebContentsForInputRouting(), blink::WebInputEvent::kShiftKey,
blink::WebMouseEvent::Button::kLeft, GetLinkPosition());
observer.Wait();
ASSERT_EQ(2U, chrome::GetTotalBrowserCount());
......@@ -2099,6 +2105,11 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionTest, ServiceWorkerInterception) {
#endif
IN_PROC_BROWSER_TEST_F(PDFExtensionTest, MAYBE_EmbeddedPdfGetsFocus) {
if (content::MimeHandlerViewMode::UsesCrossProcessFrame()) {
// This test verifies focus for a BrowserPlugin and is not relevant with
// MHVICPF since no BrowserPlugin is created with this flag.
return;
}
GURL test_iframe_url(embedded_test_server()->GetURL(
"/pdf/test-offset-cross-site-iframe.html"));
ui_test_utils::NavigateToURL(browser(), test_iframe_url);
......
......@@ -25,6 +25,7 @@
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/mime_handler_view_mode.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_renderer_host.h"
#include "extensions/browser/api/extensions_api_client.h"
......@@ -525,6 +526,11 @@ class MimeHandlerViewBrowserPluginSpecificTest : public MimeHandlerViewTest {
// the embedder knows about it.
IN_PROC_BROWSER_TEST_F(MimeHandlerViewBrowserPluginSpecificTest,
AcceptTouchEvents) {
if (content::MimeHandlerViewMode::UsesCrossProcessFrame()) {
// This test requires BrowserPlugin which does not exist in frame-based
// MimeHandlerView.
return;
}
RunTest("testBasic.csv");
content::RenderViewHost* embedder_rvh =
GetEmbedderWebContents()->GetRenderViewHost();
......@@ -559,6 +565,11 @@ IN_PROC_BROWSER_TEST_F(MimeHandlerViewBrowserPluginSpecificTest,
// Verify that a BrowserPlugin captures mouse input on MouseDown.
IN_PROC_BROWSER_TEST_F(MimeHandlerViewBrowserPluginSpecificTest,
MouseCaptureOnMouseDown) {
if (content::MimeHandlerViewMode::UsesCrossProcessFrame()) {
// This test requires BrowserPlugin which does not exist in frame-based
// MimeHandlerView.
return;
}
RunTest("testBasic.csv");
auto* guest_web_contents = GetGuestViewManager()->WaitForSingleGuestCreated();
auto* guest_widget = MimeHandlerViewGuest::FromWebContents(guest_web_contents)
......
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