OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/timer.h" | 8 #include "base/timer.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // Make sure we sent the input event to the renderer. | 626 // Make sure we sent the input event to the renderer. |
627 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( | 627 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( |
628 ViewMsg_HandleInputEvent::ID)); | 628 ViewMsg_HandleInputEvent::ID)); |
629 process_->sink().ClearMessages(); | 629 process_->sink().ClearMessages(); |
630 | 630 |
631 // Send the simulated response from the renderer back. | 631 // Send the simulated response from the renderer back. |
632 SendInputEventACK(WebInputEvent::RawKeyDown, true); | 632 SendInputEventACK(WebInputEvent::RawKeyDown, true); |
633 EXPECT_FALSE(host_->unhandled_keyboard_event_called()); | 633 EXPECT_FALSE(host_->unhandled_keyboard_event_called()); |
634 } | 634 } |
635 | 635 |
636 // Fails on Linux Aura, see http://crbug.com/100345 | 636 TEST_F(RenderWidgetHostTest, PreHandleRawKeyDownEvent) { |
637 #if defined(USE_AURA) && !defined(OS_WIN) | |
638 #define MAYBE_PreHandleRawKeyDownEvent FAILS_PreHandleRawKeyDownEvent | |
639 #else | |
640 #define MAYBE_PreHandleRawKeyDownEvent PreHandleRawKeyDownEvent | |
641 #endif | |
642 TEST_F(RenderWidgetHostTest, MAYBE_PreHandleRawKeyDownEvent) { | |
643 // Simluate the situation that the browser handled the key down event during | 637 // Simluate the situation that the browser handled the key down event during |
644 // pre-handle phrase. | 638 // pre-handle phrase. |
645 host_->set_prehandle_keyboard_event(true); | 639 host_->set_prehandle_keyboard_event(true); |
646 process_->sink().ClearMessages(); | 640 process_->sink().ClearMessages(); |
647 | 641 |
648 // Simulate a keyboard event. | 642 // Simulate a keyboard event. |
649 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 643 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
650 | 644 |
651 EXPECT_TRUE(host_->prehandle_keyboard_event_called()); | 645 EXPECT_TRUE(host_->prehandle_keyboard_event_called()); |
652 EXPECT_EQ(WebInputEvent::RawKeyDown, host_->prehandle_keyboard_event_type()); | 646 EXPECT_EQ(WebInputEvent::RawKeyDown, host_->prehandle_keyboard_event_type()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // Start it again to ensure it still works. | 740 // Start it again to ensure it still works. |
747 EXPECT_FALSE(host_->unresponsive_timer_fired()); | 741 EXPECT_FALSE(host_->unresponsive_timer_fired()); |
748 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); | 742 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); |
749 | 743 |
750 // Wait long enough for first timeout and see if it fired. | 744 // Wait long enough for first timeout and see if it fired. |
751 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 745 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
752 new MessageLoop::QuitTask(), 10); | 746 new MessageLoop::QuitTask(), 10); |
753 MessageLoop::current()->Run(); | 747 MessageLoop::current()->Run(); |
754 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 748 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
755 } | 749 } |
OLD | NEW |