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

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

Issue 10827145: Convert Aura to use ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.cc ('k') | ui/aura/aura.gyp » ('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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 6
7 #include "base/shared_memory.h" 7 #include "base/shared_memory.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/common/intents_messages.h" 10 #include "content/common/intents_messages.h"
(...skipping 22 matching lines...) Expand all
33 #include "ui/base/range/range.h" 33 #include "ui/base/range/range.h"
34 #include "ui/gfx/codec/jpeg_codec.h" 34 #include "ui/gfx/codec/jpeg_codec.h"
35 #include "webkit/glue/glue_serialize.h" 35 #include "webkit/glue/glue_serialize.h"
36 #include "webkit/glue/web_io_operators.h" 36 #include "webkit/glue/web_io_operators.h"
37 37
38 #if defined(OS_LINUX) && !defined(USE_AURA) 38 #if defined(OS_LINUX) && !defined(USE_AURA)
39 #include "ui/base/gtk/event_synthesis_gtk.h" 39 #include "ui/base/gtk/event_synthesis_gtk.h"
40 #endif 40 #endif
41 41
42 #if defined(USE_AURA) 42 #if defined(USE_AURA)
43 #include "ui/aura/event.h" 43 #include "ui/base/event.h"
44 #endif 44 #endif
45 45
46 #if defined(USE_AURA) && defined(USE_X11) 46 #if defined(USE_AURA) && defined(USE_X11)
47 #include <X11/Xlib.h> 47 #include <X11/Xlib.h>
48 #include "ui/base/events.h" 48 #include "ui/base/events.h"
49 #include "ui/base/keycodes/keyboard_code_conversion.h" 49 #include "ui/base/keycodes/keyboard_code_conversion.h"
50 #include "ui/base/x/x11_util.h" 50 #include "ui/base/x/x11_util.h"
51 #endif 51 #endif
52 52
53 using WebKit::WebFrame; 53 using WebKit::WebFrame;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return -1; 169 return -1;
170 170
171 // Create IPC messages from Windows messages and send them to our 171 // Create IPC messages from Windows messages and send them to our
172 // back-end. 172 // back-end.
173 // A keyboard event of Windows consists of three Windows messages: 173 // A keyboard event of Windows consists of three Windows messages:
174 // WM_KEYDOWN, WM_CHAR, and WM_KEYUP. 174 // WM_KEYDOWN, WM_CHAR, and WM_KEYUP.
175 // WM_KEYDOWN and WM_KEYUP sends virtual-key codes. On the other hand, 175 // WM_KEYDOWN and WM_KEYUP sends virtual-key codes. On the other hand,
176 // WM_CHAR sends a composed Unicode character. 176 // WM_CHAR sends a composed Unicode character.
177 MSG msg1 = { NULL, WM_KEYDOWN, key_code, 0 }; 177 MSG msg1 = { NULL, WM_KEYDOWN, key_code, 0 };
178 #if defined(USE_AURA) 178 #if defined(USE_AURA)
179 aura::KeyEvent evt1(msg1, false); 179 ui::KeyEvent evt1(msg1, false);
180 NativeWebKeyboardEvent keydown_event(&evt1); 180 NativeWebKeyboardEvent keydown_event(&evt1);
181 #else 181 #else
182 NativeWebKeyboardEvent keydown_event(msg1); 182 NativeWebKeyboardEvent keydown_event(msg1);
183 #endif 183 #endif
184 SendNativeKeyEvent(keydown_event); 184 SendNativeKeyEvent(keydown_event);
185 185
186 MSG msg2 = { NULL, WM_CHAR, (*output)[0], 0 }; 186 MSG msg2 = { NULL, WM_CHAR, (*output)[0], 0 };
187 #if defined(USE_AURA) 187 #if defined(USE_AURA)
188 aura::KeyEvent evt2(msg2, true); 188 ui::KeyEvent evt2(msg2, true);
189 NativeWebKeyboardEvent char_event(&evt2); 189 NativeWebKeyboardEvent char_event(&evt2);
190 #else 190 #else
191 NativeWebKeyboardEvent char_event(msg2); 191 NativeWebKeyboardEvent char_event(msg2);
192 #endif 192 #endif
193 SendNativeKeyEvent(char_event); 193 SendNativeKeyEvent(char_event);
194 194
195 MSG msg3 = { NULL, WM_KEYUP, key_code, 0 }; 195 MSG msg3 = { NULL, WM_KEYUP, key_code, 0 };
196 #if defined(USE_AURA) 196 #if defined(USE_AURA)
197 aura::KeyEvent evt3(msg3, false); 197 ui::KeyEvent evt3(msg3, false);
198 NativeWebKeyboardEvent keyup_event(&evt3); 198 NativeWebKeyboardEvent keyup_event(&evt3);
199 #else 199 #else
200 NativeWebKeyboardEvent keyup_event(msg3); 200 NativeWebKeyboardEvent keyup_event(msg3);
201 #endif 201 #endif
202 SendNativeKeyEvent(keyup_event); 202 SendNativeKeyEvent(keyup_event);
203 203
204 return length; 204 return length;
205 #elif defined(USE_AURA) && defined(USE_X11) 205 #elif defined(USE_AURA) && defined(USE_X11)
206 // We ignore |layout|, which means we are only testing the layout of the 206 // We ignore |layout|, which means we are only testing the layout of the
207 // current locale. TODO(mazda): fix this to respect |layout|. 207 // current locale. TODO(mazda): fix this to respect |layout|.
208 CHECK(output); 208 CHECK(output);
209 const int flags = ConvertMockKeyboardModifier(modifiers); 209 const int flags = ConvertMockKeyboardModifier(modifiers);
210 210
211 XEvent xevent1; 211 XEvent xevent1;
212 InitXKeyEventForTesting(ui::ET_KEY_PRESSED, 212 InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
213 static_cast<ui::KeyboardCode>(key_code), 213 static_cast<ui::KeyboardCode>(key_code),
214 flags, 214 flags,
215 &xevent1); 215 &xevent1);
216 aura::KeyEvent event1(&xevent1, false); 216 ui::KeyEvent event1(&xevent1, false);
217 NativeWebKeyboardEvent keydown_event(&event1); 217 NativeWebKeyboardEvent keydown_event(&event1);
218 SendNativeKeyEvent(keydown_event); 218 SendNativeKeyEvent(keydown_event);
219 219
220 XEvent xevent2; 220 XEvent xevent2;
221 InitXKeyEventForTesting(ui::ET_KEY_PRESSED, 221 InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
222 static_cast<ui::KeyboardCode>(key_code), 222 static_cast<ui::KeyboardCode>(key_code),
223 flags, 223 flags,
224 &xevent2); 224 &xevent2);
225 aura::KeyEvent event2(&xevent2, true); 225 ui::KeyEvent event2(&xevent2, true);
226 NativeWebKeyboardEvent char_event(&event2); 226 NativeWebKeyboardEvent char_event(&event2);
227 SendNativeKeyEvent(char_event); 227 SendNativeKeyEvent(char_event);
228 228
229 XEvent xevent3; 229 XEvent xevent3;
230 InitXKeyEventForTesting(ui::ET_KEY_RELEASED, 230 InitXKeyEventForTesting(ui::ET_KEY_RELEASED,
231 static_cast<ui::KeyboardCode>(key_code), 231 static_cast<ui::KeyboardCode>(key_code),
232 flags, 232 flags,
233 &xevent3); 233 &xevent3);
234 aura::KeyEvent event3(&xevent3, false); 234 ui::KeyEvent event3(&xevent3, false);
235 NativeWebKeyboardEvent keyup_event(&event3); 235 NativeWebKeyboardEvent keyup_event(&event3);
236 SendNativeKeyEvent(keyup_event); 236 SendNativeKeyEvent(keyup_event);
237 237
238 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code), 238 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code),
239 flags); 239 flags);
240 output->assign(1, static_cast<char16>(c)); 240 output->assign(1, static_cast<char16>(c));
241 return 1; 241 return 1;
242 #elif defined(OS_LINUX) 242 #elif defined(OS_LINUX)
243 // We ignore |layout|, which means we are only testing the layout of the 243 // We ignore |layout|, which means we are only testing the layout of the
244 // current locale. TODO(estade): fix this to respect |layout|. 244 // current locale. TODO(estade): fix this to respect |layout|.
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 // It should work even when the zoom limit is temporarily changed in the page. 1721 // It should work even when the zoom limit is temporarily changed in the page.
1722 view()->GetWebView()->zoomLimitsChanged( 1722 view()->GetWebView()->zoomLimitsChanged(
1723 WebKit::WebView::zoomFactorToZoomLevel(1.0), 1723 WebKit::WebView::zoomFactorToZoomLevel(1.0),
1724 WebKit::WebView::zoomFactorToZoomLevel(1.0)); 1724 WebKit::WebView::zoomFactorToZoomLevel(1.0));
1725 params.url = GURL("data:text/html,max_zoomlimit_test"); 1725 params.url = GURL("data:text/html,max_zoomlimit_test");
1726 view()->OnSetZoomLevelForLoadingURL(params.url, kMaxZoomLevel); 1726 view()->OnSetZoomLevelForLoadingURL(params.url, kMaxZoomLevel);
1727 view()->OnNavigate(params); 1727 view()->OnNavigate(params);
1728 ProcessPendingMessages(); 1728 ProcessPendingMessages();
1729 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); 1729 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel());
1730 } 1730 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.cc ('k') | ui/aura/aura.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698