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

Side by Side Diff: content/public/test/text_input_test_utils.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/text_input_test_utils.h" 5 #include "content/public/test/text_input_test_utils.h"
6 6
7 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 7 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
8 #include "content/browser/renderer_host/render_widget_host_view_base.h" 8 #include "content/browser/renderer_host/render_widget_host_view_base.h"
9 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" 9 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h"
10 #include "content/browser/renderer_host/text_input_manager.h" 10 #include "content/browser/renderer_host/text_input_manager.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 RenderWidgetHostViewBase* view_base = 193 RenderWidgetHostViewBase* view_base =
194 static_cast<RenderWidgetHostViewBase*>(view); 194 static_cast<RenderWidgetHostViewBase*>(view);
195 if (!manager || !manager->IsRegistered(view_base)) 195 if (!manager || !manager->IsRegistered(view_base))
196 return false; 196 return false;
197 197
198 *type = manager->text_input_state_map_[view_base].type; 198 *type = manager->text_input_state_map_[view_base].type;
199 return true; 199 return true;
200 } 200 }
201 201
202 std::unordered_set<RenderWidgetHostView*>
203 GetAllViewsRegisteredWithTextInputManager(WebContents* web_contents) {
204 std::unordered_set<RenderWidgetHostView*> views;
205 TextInputManager* manager =
206 static_cast<WebContentsImpl*>(web_contents)->GetTextInputManager();
207 if (manager) {
208 for (auto pair : manager->text_input_state_map_)
209 views.insert(pair.first);
210 }
211 return views;
212 }
213
202 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents) { 214 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents) {
203 return static_cast<WebContentsImpl*>(web_contents) 215 return static_cast<WebContentsImpl*>(web_contents)
204 ->GetTextInputManager() 216 ->GetTextInputManager()
205 ->GetActiveView(); 217 ->GetActiveView();
206 } 218 }
207 219
208 TextInputManagerTester::TextInputManagerTester(WebContents* web_contents) 220 TextInputManagerTester::TextInputManagerTester(WebContents* web_contents)
209 : observer_(new InternalObserver(web_contents, this)) {} 221 : observer_(new InternalObserver(web_contents, this)) {}
210 222
211 TextInputManagerTester::~TextInputManagerTester() {} 223 TextInputManagerTester::~TextInputManagerTester() {}
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 328
317 #ifdef USE_AURA 329 #ifdef USE_AURA
318 RenderWidgetHostViewAura* view = static_cast<RenderWidgetHostViewAura*>( 330 RenderWidgetHostViewAura* view = static_cast<RenderWidgetHostViewAura*>(
319 web_contents->GetRenderWidgetHostView()); 331 web_contents->GetRenderWidgetHostView());
320 observer.reset(new InputMethodObserverAura(view->GetInputMethod())); 332 observer.reset(new InputMethodObserverAura(view->GetInputMethod()));
321 #endif 333 #endif
322 return observer; 334 return observer;
323 } 335 }
324 336
325 } // namespace content 337 } // namespace content
OLDNEW
« content/public/test/text_input_test_utils.h ('K') | « content/public/test/text_input_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698