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

Unified Diff: chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc

Issue 2536943004: Fix a crash occuring during the destruction of TextInputManager on Android. (Closed)
Patch Set: Fixed a typo. Created 4 years, 1 month 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 | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc
diff --git a/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc b/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc
index d4cb8d2b6d103e9cac5877c85f8b235306dbaa15..2d94731ea2fbfccd452c04a64c50df0103b7687a 100644
--- a/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc
+++ b/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc
@@ -638,6 +638,27 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
reset_state_observer.Wait();
}
+// This test verifies that if we have a focused <input> in the main frame and
+// the tab is closed, TextInputManager handles unregistering itself and
+// notifying the observers properly (see https://crbug.com/669375).
+IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
+ ClosingTabWillNotCrash) {
+ CreateIframePage("a()");
+ content::RenderFrameHost* main_frame = GetFrame(IndexVector{});
+ AddInputFieldToFrame(main_frame, "text", "", false);
+
+ // Focus the input and wait for state update.
+ TextInputManagerTypeObserver observer(active_contents(),
+ ui::TEXT_INPUT_TYPE_TEXT);
+ SimulateKeyPress(active_contents(), ui::DomKey::TAB, ui::DomCode::TAB,
+ ui::VKEY_TAB, false, false, false, false);
+ observer.Wait();
+
+ // Now destroy the tab. We should exit without crashing.
+ browser()->tab_strip_model()->CloseWebContentsAt(
+ 0, TabStripModel::CLOSE_USER_GESTURE);
+}
+
// The following test verifies that when the active widget changes value, it is
// always from nullptr to non-null or vice versa.
IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
@@ -847,7 +868,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
}
}
-
// TODO(ekaramad): The following tests are specifically written for Aura and are
// based on InputMethodObserver. Write similar tests for Mac/Android/Mus
// (crbug.com/602723).
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698