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

Unified Diff: content/public/test/text_input_test_utils.cc

Issue 2903833002: Reland: Update TextSelection for non-user initiated events
Patch Set: Add test for JS cursor movement Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/text_input_test_utils.h ('k') | content/renderer/input/frame_input_handler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/text_input_test_utils.cc
diff --git a/content/public/test/text_input_test_utils.cc b/content/public/test/text_input_test_utils.cc
index 65ec8d2d9cd5e949bfba14077d026323bbf0466f..4ea9b00cdd3fadd917513980feebee5ea2e4c20f 100644
--- a/content/public/test/text_input_test_utils.cc
+++ b/content/public/test/text_input_test_utils.cc
@@ -363,6 +363,16 @@ bool TextInputManagerTester::GetTextInputValue(std::string* value) {
return true;
}
+bool TextInputManagerTester::GetTextInputCursorPosition(int* position) {
+ DCHECK(observer_->text_input_manager());
+ const TextInputState* state =
+ observer_->text_input_manager()->GetTextInputState();
+ if (!state)
+ return false;
+ *position = state->selection_start;
+ return true;
+}
+
const RenderWidgetHostView* TextInputManagerTester::GetActiveView() {
DCHECK(observer_->text_input_manager());
return observer_->text_input_manager()->active_view_for_testing();
@@ -389,6 +399,21 @@ bool TextInputManagerTester::GetLastCompositionRangeLength(uint32_t* length) {
return true;
}
+bool TextInputManagerTester::GetTextSelectionUserInitiatedForView(
+ RenderWidgetHostView* view,
+ bool* user_initiated) {
+ TextInputManager* manager = observer_->text_input_manager();
+ DCHECK(manager);
+
+ RenderWidgetHostViewBase* view_base =
+ static_cast<RenderWidgetHostViewBase*>(view);
+ if (!manager->IsRegistered(view_base))
+ return false;
+
+ *user_initiated = manager->GetTextSelection(view_base)->user_initiated();
+ return true;
+}
+
bool TextInputManagerTester::IsTextInputStateChanged() {
return observer_->text_input_state_changed();
}
« no previous file with comments | « content/public/test/text_input_test_utils.h ('k') | content/renderer/input/frame_input_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698