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

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 lazyboy@ comment 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2e87bc47989416f3c443655edeab9f1cdbf7b4c5 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);
@@ -1437,7 +1435,43 @@ IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
// Now crash the <webview>.
guest_web_contents()->GetRenderProcessHost()->Shutdown(false, 0);
- // State should reset to none.
+ // Wait for the outer WebContentsImpl |text_input_state_->type| to be reset to
+ // none.
+ TextInputStateHelper::WaitForDesiredState(
+ embedder_web_contents(),
+ 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);
+ detach_listener.set_failure_message("failed-to-detach");
+ EXPECT_TRUE(
+ content::ExecuteScript(embedder_web_contents(), "detachWebView();"));
+ detach_listener.WaitUntilSatisfied();
+
+ // Wait for the outer WebContentsImpl |text_input_state_->type| to be reset to
+ // none.
TextInputStateHelper::WaitForDesiredState(
embedder_web_contents(),
base::Bind(&TextInputStateHelper::IsStateOfGivenType,
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698