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

Unified Diff: components/arc/ime/arc_ime_service_unittest.cc

Issue 2876693004: Implement GetTextFromRange(), GetTextRange() and GetSelectionRange() for ArcImeService. (Closed)
Patch Set: add TODOs in ime.mojom Created 3 years, 7 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 | « components/arc/ime/arc_ime_service.cc ('k') | components/arc/ime/arc_ime_struct_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/ime/arc_ime_service_unittest.cc
diff --git a/components/arc/ime/arc_ime_service_unittest.cc b/components/arc/ime/arc_ime_service_unittest.cc
index ad1c52228d06711d7b7ae5feda13917a230b936d..b141a3c3a4be766e147f94ca640631954b453524 100644
--- a/components/arc/ime/arc_ime_service_unittest.cc
+++ b/components/arc/ime/arc_ime_service_unittest.cc
@@ -265,4 +265,29 @@ TEST_F(ArcImeServiceTest, WindowFocusTracking) {
EXPECT_EQ(2, fake_input_method_->count_set_focused_text_input_client());
}
+TEST_F(ArcImeServiceTest, GetTextFromRange) {
+ instance_->OnWindowFocused(arc_win_.get(), nullptr);
+
+ const base::string16 text = base::ASCIIToUTF16("abcdefghijklmn");
+ // Assume the cursor is between 'c' and 'd'.
+ const uint32_t cursor_pos = 3;
+ const gfx::Range text_range(cursor_pos - 1, cursor_pos + 1);
+ const base::string16 text_in_range = text.substr(cursor_pos - 1, 2);
+ const gfx::Range selection_range(cursor_pos, cursor_pos);
+
+ instance_->OnCursorRectChangedWithSurroundingText(
+ gfx::Rect(0, 0, 1, 1), text_range, text_in_range, selection_range);
+
+ gfx::Range temp;
+ instance_->GetTextRange(&temp);
+ EXPECT_EQ(text_range, temp);
+
+ base::string16 temp_str;
+ instance_->GetTextFromRange(text_range, &temp_str);
+ EXPECT_EQ(text_in_range, temp_str);
+
+ instance_->GetSelectionRange(&temp);
+ EXPECT_EQ(selection_range, temp);
+}
+
} // namespace arc
« no previous file with comments | « components/arc/ime/arc_ime_service.cc ('k') | components/arc/ime/arc_ime_struct_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698