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

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: Addressing creis@ comments 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..385f2e776fe50293de5dc33ec43f0cf8489fee87 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -1415,14 +1415,12 @@ 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.
IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
CrashingWebViewResetsState) {
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>,
+ // Press tab key twice to end up in the <input> of the <webview>.
ExtensionTestMessageListener listener("GUEST-FOCUSED", false);
for (size_t i = 0; i < 2; ++i)
SendKeyPressToPlatformApp(ui::VKEY_TAB);
@@ -1443,3 +1441,36 @@ IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
base::Bind(&TextInputStateHelper::IsStateOfGivenType,
ui::TEXT_INPUT_TYPE_NONE));
}
+
+// This test creates a <webview> with a text input field inside, gives focus to
+// 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>.
+ 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 detach the <webview>.
+ ExtensionTestMessageListener detach_listener("detached", false);
+ EXPECT_TRUE(
+ content::ExecuteScript(embedder_web_contents(), "detachWebView();"));
+ detach_listener.WaitUntilSatisfied();
+
+ // State should reset to none.
lazyboy 2016/04/12 04:11:54 nit: TextInputState should reset.
EhsanK 2016/04/12 15:06:49 Done.
+ TextInputStateHelper::WaitForDesiredState(
+ embedder_web_contents(),
+ base::Bind(&TextInputStateHelper::IsStateOfGivenType,
+ ui::TEXT_INPUT_TYPE_NONE));
+}

Powered by Google App Engine
This is Rietveld 408576698