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

Unified Diff: content/renderer/render_view_browsertest.cc

Issue 10836053: Add IPCs/methods for additional IME actions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: now calling WebKit implementations of setCompositionFromExistingText and ExtendSelectionAndDelete; … Created 8 years, 4 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/common/view_messages.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_browsertest.cc
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index b8ec2149f8e1c17f0e7bfa5898b96d5127321f62..f4b6cd9cea0c14bfe049f749bcb85992031864c1 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -1728,3 +1728,66 @@ TEST_F(RenderViewImplTest, ZoomLimit) {
ProcessPendingMessages();
EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel());
}
+
rniwa-cr 2012/08/23 17:46:26 Why didn't we add these tests in webkit side?
olilan 2012/08/24 09:30:49 Equivalent tests have been added on the webkit sid
+TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) {
+ // Load an HTML page consisting of an input field.
+ LoadHTML("<html>"
+ "<head>"
+ "</head>"
+ "<body>"
+ "<input id=\"test1\" value=\"some test text hello\"></input>"
+ "</body>"
+ "</html>");
+ ExecuteJavaScript("document.getElementById('test1').focus();");
+ view()->OnSetEditableSelectionOffsets(4, 8);
+ const std::vector<WebKit::WebCompositionUnderline> empty_underline;
+ view()->OnSetCompositionFromExistingText(7,10, empty_underline);
+ WebKit::WebTextInputInfo info = view()->webview()->textInputInfo();
+ EXPECT_EQ(4, info.selectionStart);
+ EXPECT_EQ(8, info.selectionEnd);
+ EXPECT_EQ(7, info.compositionStart);
+ EXPECT_EQ(10, info.compositionEnd);
+ view()->OnUnselect();
+ info = view()->webview()->textInputInfo();
+ EXPECT_EQ(0, info.selectionStart);
+ EXPECT_EQ(0, info.selectionEnd);
+}
+
+TEST_F(RenderViewImplTest, OnReplaceAll) {
+ // Load an HTML page consisting of an input field.
+ LoadHTML("<html>"
+ "<head>"
+ "</head>"
+ "<body>"
+ "<input id=\"test1\" value=\"some test text hello\"></input>"
+ "</body>"
+ "</html>");
+ ExecuteJavaScript("document.getElementById('test1').focus();");
+ view()->OnReplaceAll(UTF8ToUTF16("replacement words"));
+ WebKit::WebTextInputInfo info = view()->webview()->textInputInfo();
+ EXPECT_EQ("replacement words", info.value);
+}
+
+TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) {
+ // Load an HTML page consisting of an input field.
+ LoadHTML("<html>"
+ "<head>"
+ "</head>"
+ "<body>"
+ "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>"
+ "</body>"
+ "</html>");
+ ExecuteJavaScript("document.getElementById('test1').focus();");
+ view()->OnSetEditableSelectionOffsets(10, 10);
+ view()->OnExtendSelectionAndDelete(3, 4);
+ WebKit::WebTextInputInfo info = view()->webview()->textInputInfo();
+ EXPECT_EQ("abcdefgopqrstuvwxyz", info.value);
+ EXPECT_EQ(7, info.selectionStart);
+ EXPECT_EQ(7, info.selectionEnd);
+ view()->OnSetEditableSelectionOffsets(4, 8);
+ view()->OnExtendSelectionAndDelete(2, 5);
+ info = view()->webview()->textInputInfo();
+ EXPECT_EQ("abuvwxyz", info.value);
+ EXPECT_EQ(2, info.selectionStart);
+ EXPECT_EQ(2, info.selectionEnd);
+}
« no previous file with comments | « content/common/view_messages.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698