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

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: Addressing sky@'s comments Created 4 years, 5 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
« no previous file with comments | « content/public/test/text_input_test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <unordered_set>
8
7 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 10 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
9 #include "content/browser/renderer_host/render_widget_host_view_base.h" 11 #include "content/browser/renderer_host/render_widget_host_view_base.h"
10 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" 12 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h"
11 #include "content/browser/renderer_host/text_input_manager.h" 13 #include "content/browser/renderer_host/text_input_manager.h"
12 #include "content/browser/web_contents/web_contents_impl.h" 14 #include "content/browser/web_contents/web_contents_impl.h"
13 #include "content/common/text_input_state.h" 15 #include "content/common/text_input_state.h"
14 #include "content/public/browser/render_widget_host_view.h" 16 #include "content/public/browser/render_widget_host_view.h"
15 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_contents_observer.h" 18 #include "content/public/browser/web_contents_observer.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 RenderWidgetHostView* view, 191 RenderWidgetHostView* view,
190 ui::TextInputType* type) { 192 ui::TextInputType* type) {
191 TextInputManager* manager = 193 TextInputManager* manager =
192 static_cast<WebContentsImpl*>(web_contents)->GetTextInputManager(); 194 static_cast<WebContentsImpl*>(web_contents)->GetTextInputManager();
193 195
194 RenderWidgetHostViewBase* view_base = 196 RenderWidgetHostViewBase* view_base =
195 static_cast<RenderWidgetHostViewBase*>(view); 197 static_cast<RenderWidgetHostViewBase*>(view);
196 if (!manager || !manager->IsRegistered(view_base)) 198 if (!manager || !manager->IsRegistered(view_base))
197 return false; 199 return false;
198 200
199 *type = manager->text_input_state_map_[view_base].type; 201 *type = manager->GetTextInputTypeForViewForTesting(view_base);
202
200 return true; 203 return true;
201 } 204 }
202 205
206 size_t GetRegisteredViewsCountFromTextInputManager(WebContents* web_contents) {
207 std::unordered_set<RenderWidgetHostView*> views;
208 TextInputManager* manager =
209 static_cast<WebContentsImpl*>(web_contents)->GetTextInputManager();
210 return !!manager ? manager->GetRegisteredViewsCountForTesting() : 0;
211 }
212
203 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents) { 213 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents) {
204 return static_cast<WebContentsImpl*>(web_contents) 214 return static_cast<WebContentsImpl*>(web_contents)
205 ->GetTextInputManager() 215 ->GetTextInputManager()
206 ->active_view_for_testing(); 216 ->active_view_for_testing();
207 } 217 }
208 218
209 TextInputManagerTester::TextInputManagerTester(WebContents* web_contents) 219 TextInputManagerTester::TextInputManagerTester(WebContents* web_contents)
210 : observer_(new InternalObserver(web_contents, this)) {} 220 : observer_(new InternalObserver(web_contents, this)) {}
211 221
212 TextInputManagerTester::~TextInputManagerTester() {} 222 TextInputManagerTester::~TextInputManagerTester() {}
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 327
318 #ifdef USE_AURA 328 #ifdef USE_AURA
319 RenderWidgetHostViewAura* view = static_cast<RenderWidgetHostViewAura*>( 329 RenderWidgetHostViewAura* view = static_cast<RenderWidgetHostViewAura*>(
320 web_contents->GetRenderWidgetHostView()); 330 web_contents->GetRenderWidgetHostView());
321 observer.reset(new InputMethodObserverAura(view->GetInputMethod())); 331 observer.reset(new InputMethodObserverAura(view->GetInputMethod()));
322 #endif 332 #endif
323 return observer; 333 return observer;
324 } 334 }
325 335
326 } // namespace content 336 } // namespace content
OLDNEW
« no previous file with comments | « 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