Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc

Issue 1934703002: Fix keyboard focus for OOPIF-<webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test flakiness and comments in PS 7,8. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
index a253a144c69b49783b30563b5d0e8f191c7ebb13..8e655386b5461e7e0215210b45206b7a5a48f6c8 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -26,6 +26,7 @@
#include "components/guest_view/browser/guest_view_manager_factory.h"
#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
@@ -227,6 +228,7 @@ class WebViewInteractiveTestBase : public extensions::PlatformAppBrowserTest {
ASSERT_TRUE(done_listener);
ASSERT_TRUE(done_listener->WaitUntilSatisfied());
+ embedder_web_contents_ = embedder_web_contents;
guest_web_contents_ = GetGuestViewManager()->WaitForSingleGuestCreated();
}
@@ -1347,3 +1349,38 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, FocusAndVisibility) {
SendMessageToEmbedder("verify");
EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied());
}
+
+IN_PROC_BROWSER_TEST_P(WebViewInteractiveTest, KeyboardFocus) {
+ TestHelper("testKeyboardFocus", "web_view/focus", NO_TEST_SERVER);
+
+ EXPECT_EQ(embedder_web_contents()->GetFocusedFrame(),
+ embedder_web_contents()->GetMainFrame());
+ content::FrameFocusedObserver focus_observer(
+ guest_web_contents()->GetMainFrame());
+ {
+ gfx::Rect offset = embedder_web_contents()->GetContainerBounds();
+ // Click the <input> element inside the <webview>.
+ // If we wanted, we could ask the embedder to compute an appropriate point.
+ MoveMouseInsideWindow(gfx::Point(offset.x() + 40, offset.y() + 40));
+ SendMouseClick(ui_controls::LEFT);
+ }
+ focus_observer.Wait();
+ if (GetParam()) {
alexmos 2016/06/24 01:38:49 nit: { not necessary
avallee 2016/07/25 19:02:05 Done.
+ EXPECT_EQ(embedder_web_contents()->GetFocusedFrame(), nullptr);
+ }
+
+ ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
+ GetPlatformAppWindow(), ui::VKEY_A, false, false, false, false));
+ ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
+ GetPlatformAppWindow(), ui::VKEY_B, false, true, false, false));
+ ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
+ GetPlatformAppWindow(), ui::VKEY_C, false, false, false, false));
+
+ ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
+ next_step_listener.set_failure_message("TEST_STEP_FAILED");
+ EXPECT_TRUE(content::ExecuteScript(
+ embedder_web_contents(),
+ "window.runCommand('testKeyboardFocusRunNextStep', 'aBc');"));
+
+ ASSERT_TRUE(next_step_listener.WaitUntilSatisfied());
+}

Powered by Google App Engine
This is Rietveld 408576698