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

Side by Side Diff: content/renderer/render_widget_browsertest.cc

Issue 2323983003: DO NOT SUBMIT: Bundle IME-related messages into one for batch edit (Closed)
Patch Set: fixed nits and fixed blimp test Created 4 years, 3 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/renderer/render_widget.cc ('k') | content/test/test_render_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/resize_params.h" 5 #include "content/common/resize_params.h"
6 #include "content/public/test/render_view_test.h" 6 #include "content/public/test/render_view_test.h"
7 #include "content/renderer/render_view_impl.h" 7 #include "content/renderer/render_view_impl.h"
8 #include "content/renderer/render_widget.h" 8 #include "content/renderer/render_widget.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 class RenderWidgetTest : public RenderViewTest { 12 class RenderWidgetTest : public RenderViewTest {
13 protected: 13 protected:
14 RenderWidget* widget() { 14 RenderWidget* widget() {
15 return static_cast<RenderViewImpl*>(view_)->GetWidget(); 15 return static_cast<RenderViewImpl*>(view_)->GetWidget();
16 } 16 }
17 17
18 void OnResize(const ResizeParams& params) { 18 void OnResize(const ResizeParams& params) {
19 widget()->OnResize(params); 19 widget()->OnResize(params);
20 } 20 }
21 21
22 void GetCompositionRange(gfx::Range* range) { 22 void GetCompositionRange(gfx::Range* range) {
23 widget()->GetCompositionRange(range); 23 widget()->GetCompositionRange(range);
24 } 24 }
25 25
26 void SetEditableSelectionOffsets(int start, int end) {
27 widget()->OnImeSetEditableSelectionOffsets(10, 10);
28 }
29
30 void ExtendSelectionAndDelete(int start, int end) {
31 widget()->OnImeExtendSelectionAndDelete(3, 4);
32 }
33
26 bool next_paint_is_resize_ack() { 34 bool next_paint_is_resize_ack() {
27 return widget()->next_paint_is_resize_ack(); 35 return widget()->next_paint_is_resize_ack();
28 } 36 }
29 }; 37 };
30 38
31 TEST_F(RenderWidgetTest, OnResize) { 39 TEST_F(RenderWidgetTest, OnResize) {
32 // The initial bounds is empty, so setting it to the same thing should do 40 // The initial bounds is empty, so setting it to the same thing should do
33 // nothing. 41 // nothing.
34 ResizeParams resize_params; 42 ResizeParams resize_params;
35 resize_params.screen_info = ScreenInfo(); 43 resize_params.screen_info = ScreenInfo();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 TEST_F(RenderWidgetTest, GetCompositionRangeInvalid) { 140 TEST_F(RenderWidgetTest, GetCompositionRangeInvalid) {
133 LoadHTML("<div>NOT EDITABLE</div>"); 141 LoadHTML("<div>NOT EDITABLE</div>");
134 gfx::Range range; 142 gfx::Range range;
135 GetCompositionRange(&range); 143 GetCompositionRange(&range);
136 // If this test ever starts failing, one likely outcome is that WebRange 144 // If this test ever starts failing, one likely outcome is that WebRange
137 // and gfx::Range::InvalidRange are no longer expressed in the same 145 // and gfx::Range::InvalidRange are no longer expressed in the same
138 // values of start/end. 146 // values of start/end.
139 EXPECT_FALSE(range.IsValid()); 147 EXPECT_FALSE(range.IsValid());
140 } 148 }
141 149
150 TEST_F(RenderWidgetTest, OnExtendSelectionAndDelete) {
151 // Load an HTML page consisting of an input field.
152 LoadHTML("<html>"
153 "<head>"
154 "</head>"
155 "<body>"
156 "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>"
157 "</body>"
158 "</html>");
159 ExecuteJavaScriptForTests("document.getElementById('test1').focus();");
160 SetEditableSelectionOffsets(10, 10);
161 ExtendSelectionAndDelete(3, 4);
162 blink::WebTextInputInfo info = widget()->webwidget()->textInputInfo();
163 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value);
164 EXPECT_EQ(7, info.selectionStart);
165 EXPECT_EQ(7, info.selectionEnd);
166 SetEditableSelectionOffsets(4, 8);
167 ExtendSelectionAndDelete(2, 5);
168 info = widget()->webwidget()->textInputInfo();
169 EXPECT_EQ("abuvwxyz", info.value);
170 EXPECT_EQ(2, info.selectionStart);
171 EXPECT_EQ(2, info.selectionEnd);
172 }
173
142 } // namespace content 174 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.cc ('k') | content/test/test_render_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698