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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 789153004: Fix Chromoting under Ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit test Created 6 years 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
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/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "ui/aura/window.h" 48 #include "ui/aura/window.h"
49 #include "ui/aura/window_event_dispatcher.h" 49 #include "ui/aura/window_event_dispatcher.h"
50 #include "ui/aura/window_observer.h" 50 #include "ui/aura/window_observer.h"
51 #include "ui/base/ui_base_types.h" 51 #include "ui/base/ui_base_types.h"
52 #include "ui/compositor/compositor.h" 52 #include "ui/compositor/compositor.h"
53 #include "ui/compositor/layer_tree_owner.h" 53 #include "ui/compositor/layer_tree_owner.h"
54 #include "ui/compositor/test/draw_waiter_for_test.h" 54 #include "ui/compositor/test/draw_waiter_for_test.h"
55 #include "ui/events/event.h" 55 #include "ui/events/event.h"
56 #include "ui/events/event_utils.h" 56 #include "ui/events/event_utils.h"
57 #include "ui/events/gesture_detection/gesture_configuration.h" 57 #include "ui/events/gesture_detection/gesture_configuration.h"
58 #include "ui/events/keycodes/dom3/dom_code.h"
59 #include "ui/events/keycodes/dom4/keycode_converter.h"
58 #include "ui/events/test/event_generator.h" 60 #include "ui/events/test/event_generator.h"
59 #include "ui/wm/core/default_activation_client.h" 61 #include "ui/wm/core/default_activation_client.h"
60 #include "ui/wm/core/default_screen_position_client.h" 62 #include "ui/wm/core/default_screen_position_client.h"
61 #include "ui/wm/core/window_util.h" 63 #include "ui/wm/core/window_util.h"
62 64
63 using testing::_; 65 using testing::_;
64 66
65 using blink::WebGestureEvent; 67 using blink::WebGestureEvent;
66 using blink::WebInputEvent; 68 using blink::WebInputEvent;
67 using blink::WebMouseEvent; 69 using blink::WebMouseEvent;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 float delta_x_; 127 float delta_x_;
126 float delta_y_; 128 float delta_y_;
127 129
128 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); 130 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate);
129 }; 131 };
130 132
131 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { 133 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
132 public: 134 public:
133 MockRenderWidgetHostDelegate() {} 135 MockRenderWidgetHostDelegate() {}
134 ~MockRenderWidgetHostDelegate() override {} 136 ~MockRenderWidgetHostDelegate() override {}
137 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); }
138 protected:
139 // RenderWidgetHostDelegate:
140 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
141 bool* is_keyboard_shortcut) override {
142 last_event_.reset(new NativeWebKeyboardEvent(event));
143 return true;
144 }
145 private:
146 scoped_ptr<NativeWebKeyboardEvent> last_event_;
sadrul 2014/12/11 19:20:57 DISALLOW_COPY_...
135 }; 147 };
136 148
137 // Simple observer that keeps track of changes to a window for tests. 149 // Simple observer that keeps track of changes to a window for tests.
138 class TestWindowObserver : public aura::WindowObserver { 150 class TestWindowObserver : public aura::WindowObserver {
139 public: 151 public:
140 explicit TestWindowObserver(aura::Window* window_to_observe) 152 explicit TestWindowObserver(aura::Window* window_to_observe)
141 : window_(window_to_observe) { 153 : window_(window_to_observe) {
142 window_->AddObserver(this); 154 window_->AddObserver(this);
143 } 155 }
144 ~TestWindowObserver() override { 156 ~TestWindowObserver() override {
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 2974
2963 view_->OnTouchEvent(&press); 2975 view_->OnTouchEvent(&press);
2964 view_->OnTouchEvent(&invalid_move); 2976 view_->OnTouchEvent(&invalid_move);
2965 // Valid press is handled asynchronously. 2977 // Valid press is handled asynchronously.
2966 EXPECT_TRUE(press.synchronous_handling_disabled()); 2978 EXPECT_TRUE(press.synchronous_handling_disabled());
2967 // Invalid move is handled synchronously, but is consumed. 2979 // Invalid move is handled synchronously, but is consumed.
2968 EXPECT_FALSE(invalid_move.synchronous_handling_disabled()); 2980 EXPECT_FALSE(invalid_move.synchronous_handling_disabled());
2969 EXPECT_TRUE(invalid_move.stopped_propagation()); 2981 EXPECT_TRUE(invalid_move.stopped_propagation());
2970 } 2982 }
2971 2983
2984 // Checks key event codes.
2985 TEST_F(RenderWidgetHostViewAuraTest, KeyEvent) {
2986 view_->InitAsChild(NULL);
2987 view_->Show();
2988
2989 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::KEY_A,
2990 ui::EF_NONE);
2991 view_->OnKeyEvent(&key_event);
2992
2993 const NativeWebKeyboardEvent* event = delegate_.last_event();
2994 EXPECT_NE(nullptr, event);
2995 if (event) {
2996 EXPECT_EQ(key_event.key_code(), event->windowsKeyCode);
2997 EXPECT_EQ(ui::KeycodeConverter::DomCodeToNativeKeycode(key_event.code()),
2998 event->nativeKeyCode);
2999 }
3000 }
3001
2972 } // namespace content 3002 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/browser/renderer_host/web_input_event_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698