OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |