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

Side by Side Diff: ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 Created 6 years, 8 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 | « ui/display/chromeos/x11/native_display_event_dispatcher_x11.cc ('k') | ui/events/events.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <X11/extensions/Xrandr.h> 5 #include <X11/extensions/Xrandr.h>
6 6
7 #undef Bool 7 #undef Bool
8 #undef None 8 #undef None
9 9
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 dispatcher_->SetTickClockForTest( 122 dispatcher_->SetTickClockForTest(
123 scoped_ptr<base::TickClock>(test_tick_clock_)); 123 scoped_ptr<base::TickClock>(test_tick_clock_));
124 } 124 }
125 125
126 NativeDisplayEventDispatcherX11Test::~NativeDisplayEventDispatcherX11Test() {} 126 NativeDisplayEventDispatcherX11Test::~NativeDisplayEventDispatcherX11Test() {}
127 127
128 void NativeDisplayEventDispatcherX11Test::DispatchScreenChangeEvent() { 128 void NativeDisplayEventDispatcherX11Test::DispatchScreenChangeEvent() {
129 XRRScreenChangeNotifyEvent event = {0}; 129 XRRScreenChangeNotifyEvent event = {0};
130 event.type = xrandr_event_base_ + RRScreenChangeNotify; 130 event.type = xrandr_event_base_ + RRScreenChangeNotify;
131 131
132 dispatcher_->Dispatch(reinterpret_cast<const base::NativeEvent>(&event)); 132 dispatcher_->DispatchEvent(reinterpret_cast<const PlatformEvent>(&event));
133 } 133 }
134 134
135 void NativeDisplayEventDispatcherX11Test::DispatchOutputChangeEvent( 135 void NativeDisplayEventDispatcherX11Test::DispatchOutputChangeEvent(
136 RROutput output, 136 RROutput output,
137 RRCrtc crtc, 137 RRCrtc crtc,
138 RRMode mode, 138 RRMode mode,
139 bool connected) { 139 bool connected) {
140 XRROutputChangeNotifyEvent event = {0}; 140 XRROutputChangeNotifyEvent event = {0};
141 event.type = xrandr_event_base_ + RRNotify; 141 event.type = xrandr_event_base_ + RRNotify;
142 event.subtype = RRNotify_OutputChange; 142 event.subtype = RRNotify_OutputChange;
143 event.output = output; 143 event.output = output;
144 event.crtc = crtc; 144 event.crtc = crtc;
145 event.mode = mode; 145 event.mode = mode;
146 event.connection = connected ? RR_Connected : RR_Disconnected; 146 event.connection = connected ? RR_Connected : RR_Disconnected;
147 147
148 dispatcher_->Dispatch(reinterpret_cast<const base::NativeEvent>(&event)); 148 dispatcher_->DispatchEvent(reinterpret_cast<const PlatformEvent>(&event));
149 } 149 }
150 150
151 } // namespace 151 } // namespace
152 152
153 TEST_F(NativeDisplayEventDispatcherX11Test, OnScreenChangedEvent) { 153 TEST_F(NativeDisplayEventDispatcherX11Test, OnScreenChangedEvent) {
154 DispatchScreenChangeEvent(); 154 DispatchScreenChangeEvent();
155 EXPECT_EQ(1, helper_delegate_->num_calls_update_xrandr_config()); 155 EXPECT_EQ(1, helper_delegate_->num_calls_update_xrandr_config());
156 EXPECT_EQ(0, helper_delegate_->num_calls_notify_observers()); 156 EXPECT_EQ(0, helper_delegate_->num_calls_notify_observers());
157 } 157 }
158 158
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 // Another duplicated change event arrived within expiration time will 293 // Another duplicated change event arrived within expiration time will
294 // be ignored again. 294 // be ignored again.
295 test_tick_clock_->Advance(base::TimeDelta::FromMilliseconds( 295 test_tick_clock_->Advance(base::TimeDelta::FromMilliseconds(
296 kHalfOfExpirationMs)); 296 kHalfOfExpirationMs));
297 DispatchOutputChangeEvent(2, 11, 20, true); 297 DispatchOutputChangeEvent(2, 11, 20, true);
298 EXPECT_EQ(2, helper_delegate_->num_calls_notify_observers()); 298 EXPECT_EQ(2, helper_delegate_->num_calls_notify_observers());
299 } 299 }
300 300
301 } // namespace ui 301 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/x11/native_display_event_dispatcher_x11.cc ('k') | ui/events/events.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698