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

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

Issue 2054163003: Fix SitePerProcessTextInputManagerTest.StopTrackingCrashedChildFrame on CFI Bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not assume we only have 2 views registered in the begining. 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/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 19e18971b4fcebfd9909c8c31ea2d642a54721b8..16ad2553e30780705a4bc9b9949f5032b8239155 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
@@ -323,6 +323,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
&first_view_type));
EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, first_view_type);
+ size_t registered_views_count =
EhsanK 2016/06/11 10:26:56 I was expecting this number to be 2U as it was in
+ content::GetAllViewsRegisteredWithTextInputManager(active_contents())
Charlie Reis 2016/06/13 18:46:13 We should just expose the count if we don't need t
EhsanK 2016/06/25 00:10:34 Acknowledged.
+ .size();
+
// Now that the second frame's <input> is focused, we crash the first frame
// and observe that text input state is updated for the view.
std::unique_ptr<content::TestRenderWidgetHostViewDestructionObserver>
@@ -332,21 +336,23 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
destruction_observer->Wait();
// Verifying that the TextInputManager is no longer tracking TextInputState
- // for |first_view|. Note that |first_view| is now a dangling pointer.
- EXPECT_FALSE(content::GetTextInputTypeForView(active_contents(), first_view,
- &first_view_type));
+ // for |first_view|.
+ EXPECT_EQ(
+ registered_views_count - 1U,
+ content::GetAllViewsRegisteredWithTextInputManager(active_contents())
+ .size());
// Now crash the second <iframe> which has an active view.
- content::RenderWidgetHostView* second_view = frames[1]->GetView();
TextInputManagerChangeObserver change_observer(active_contents());
frames[1]->GetProcess()->Shutdown(0, false);
change_observer.Wait();
EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE,
content::GetTextInputTypeFromWebContents(active_contents()));
EXPECT_FALSE(!!content::GetActiveViewFromWebContents(active_contents()));
- ui::TextInputType second_view_type;
- EXPECT_FALSE(content::GetTextInputTypeForView(active_contents(), second_view,
- &second_view_type));
+ EXPECT_EQ(
+ registered_views_count - 2U,
+ content::GetAllViewsRegisteredWithTextInputManager(active_contents())
+ .size());
}
// The following test loads a page with two child frames: one in process and one
« no previous file with comments | « no previous file | content/browser/renderer_host/text_input_manager.h » ('j') | content/browser/renderer_host/text_input_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698