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

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

Issue 1879453002: Reset Text Input State for RenderWidgetHostView before RenderWidgetHost Detaches from Delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a Test Created 4 years, 8 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 5c57631cb842cf99fbed35624648a8e7bfaf7d4b..66d85f47a7ac4d66e3eda5025d3ad8a856e498cb 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -1415,8 +1415,6 @@ IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
base::Bind(&TextInputStateHelper::HasGivenValue, "last one"));
}
-// TODO(ekaramad): Activate this test for OOPIF when input event routing for
-// OOPIF-<webview> is fixed.
Charlie Reis 2016/04/11 20:24:52 Why is this comment removed?
EhsanK 2016/04/11 21:59:17 The TODO is now at line 551, where the WebViewText
Charlie Reis 2016/04/11 22:18:16 Acknowledged.
IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
CrashingWebViewResetsState) {
SetupTest("web_view/text_input_state",
@@ -1443,3 +1441,36 @@ IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
base::Bind(&TextInputStateHelper::IsStateOfGivenType,
ui::TEXT_INPUT_TYPE_NONE));
}
+
+// This test creats a <webview> with a text input field inside, gives focus to
Charlie Reis 2016/04/11 20:24:52 nit: creates
EhsanK 2016/04/11 21:59:17 Done.
+// the input field, and then detaches the <webview>. It monitors the embedder
+// WebContents text input state to make sure it tracks the state properly.
+IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
+ OuterWebContentsResetsStateAfterDetach) {
+ SetupTest("web_view/text_input_state",
+ "/extensions/platform_apps/web_view/text_input_state/guest.html");
+
+ // Press tab key twice to end up in the <input> of the <webview>,
Charlie Reis 2016/04/11 20:24:52 nit: End with period, not comma.
EhsanK 2016/04/11 21:59:17 Done.
+ ExtensionTestMessageListener listener("GUEST-FOCUSED", false);
+ for (size_t i = 0; i < 2; ++i)
+ SendKeyPressToPlatformApp(ui::VKEY_TAB);
+
+ listener.WaitUntilSatisfied();
+
+ // Now wait for a text input state change.
+ TextInputStateHelper::WaitForDesiredState(
+ embedder_web_contents(),
+ base::Bind(&TextInputStateHelper::HasGivenValue, "guest"));
+
+ // Now crash the <webview>.
+ ExtensionTestMessageListener detach_listener("detached", false);
+ EXPECT_TRUE(
+ content::ExecuteScript(embedder_web_contents(), "detachWebView();"));
Charlie Reis 2016/04/11 20:24:52 How does detachWebView() crash the <webview>? Or
EhsanK 2016/04/11 21:59:17 Comment is incorrect. Thanks. s/crash/detach.
+ detach_listener.WaitUntilSatisfied();
+
+ // State should reset to none.
+ TextInputStateHelper::WaitForDesiredState(
+ embedder_web_contents(),
+ base::Bind(&TextInputStateHelper::IsStateOfGivenType,
+ ui::TEXT_INPUT_TYPE_NONE));
+}

Powered by Google App Engine
This is Rietveld 408576698