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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_unittest.cc

Issue 27332: Fixing WebKeyboardEvent. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "base/keyboard_codes.h" 6 #include "base/keyboard_codes.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/shared_memory.h" 8 #include "base/shared_memory.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/renderer_host/backing_store.h" 10 #include "chrome/browser/renderer_host/backing_store.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 ASSERT_TRUE(restored); 327 ASSERT_TRUE(restored);
328 bool needs_repaint; 328 bool needs_repaint;
329 ViewMsg_WasRestored::Read(restored, &needs_repaint); 329 ViewMsg_WasRestored::Read(restored, &needs_repaint);
330 EXPECT_TRUE(needs_repaint); 330 EXPECT_TRUE(needs_repaint);
331 } 331 }
332 332
333 TEST_F(RenderWidgetHostTest, HandleKeyEventsWeSent) { 333 TEST_F(RenderWidgetHostTest, HandleKeyEventsWeSent) {
334 WebKeyboardEvent key_event; 334 WebKeyboardEvent key_event;
335 key_event.type = WebInputEvent::KEY_DOWN; 335 key_event.type = WebInputEvent::KEY_DOWN;
336 key_event.modifiers = WebInputEvent::CTRL_KEY; 336 key_event.modifiers = WebInputEvent::CTRL_KEY;
337 key_event.key_code = base::VKEY_L; // non-null made up value. 337 key_event.windows_key_code = base::VKEY_L; // non-null made up value.
338 338
339 host_->ForwardKeyboardEvent(key_event); 339 host_->ForwardKeyboardEvent(key_event);
340 340
341 // Make sure we sent the input event to the renderer. 341 // Make sure we sent the input event to the renderer.
342 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( 342 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(
343 ViewMsg_HandleInputEvent::ID)); 343 ViewMsg_HandleInputEvent::ID));
344 process_->sink().ClearMessages(); 344 process_->sink().ClearMessages();
345 345
346 // Send the simulated response from the renderer back. 346 // Send the simulated response from the renderer back.
347 scoped_ptr<IPC::Message> response( 347 scoped_ptr<IPC::Message> response(
348 new ViewHostMsg_HandleInputEvent_ACK(0)); 348 new ViewHostMsg_HandleInputEvent_ACK(0));
349 response->WriteInt(key_event.type); 349 response->WriteInt(key_event.type);
350 response->WriteBool(false); 350 response->WriteBool(false);
351 host_->OnMessageReceived(*response); 351 host_->OnMessageReceived(*response);
352 352
353 EXPECT_TRUE(host_->unhandled_keyboard_event_called()); 353 EXPECT_TRUE(host_->unhandled_keyboard_event_called());
354 } 354 }
355 355
356 TEST_F(RenderWidgetHostTest, IgnoreKeyEventsWeDidntSend) { 356 TEST_F(RenderWidgetHostTest, IgnoreKeyEventsWeDidntSend) {
357 // Send a simulated, unrequested key response. We should ignore this. 357 // Send a simulated, unrequested key response. We should ignore this.
358 scoped_ptr<IPC::Message> response( 358 scoped_ptr<IPC::Message> response(
359 new ViewHostMsg_HandleInputEvent_ACK(0)); 359 new ViewHostMsg_HandleInputEvent_ACK(0));
360 response->WriteInt(WebInputEvent::KEY_DOWN); 360 response->WriteInt(WebInputEvent::KEY_DOWN);
361 response->WriteBool(false); 361 response->WriteBool(false);
362 host_->OnMessageReceived(*response); 362 host_->OnMessageReceived(*response);
363 363
364 EXPECT_FALSE(host_->unhandled_keyboard_event_called()); 364 EXPECT_FALSE(host_->unhandled_keyboard_event_called());
365 } 365 }
366 366
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host.cc ('k') | chrome/browser/renderer_host/render_widget_host_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698