| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <X11/extensions/Xrandr.h> | 6 #include <X11/extensions/Xrandr.h> |
| 7 | 7 |
| 8 #undef Bool | 8 #undef Bool |
| 9 #undef None | 9 #undef None |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 ~NativeDisplayEventDispatcherX11Test() override; | 117 ~NativeDisplayEventDispatcherX11Test() override; |
| 118 | 118 |
| 119 protected: | 119 protected: |
| 120 void DispatchScreenChangeEvent(); | 120 void DispatchScreenChangeEvent(); |
| 121 void DispatchOutputChangeEvent(RROutput output, | 121 void DispatchOutputChangeEvent(RROutput output, |
| 122 RRCrtc crtc, | 122 RRCrtc crtc, |
| 123 RRMode mode, | 123 RRMode mode, |
| 124 bool connected); | 124 bool connected); |
| 125 | 125 |
| 126 int xrandr_event_base_; | 126 int xrandr_event_base_; |
| 127 scoped_ptr<TestHelperDelegate> helper_delegate_; | 127 std::unique_ptr<TestHelperDelegate> helper_delegate_; |
| 128 scoped_ptr<NativeDisplayEventDispatcherX11> dispatcher_; | 128 std::unique_ptr<NativeDisplayEventDispatcherX11> dispatcher_; |
| 129 base::SimpleTestTickClock* test_tick_clock_; // Owned by |dispatcher_|. | 129 base::SimpleTestTickClock* test_tick_clock_; // Owned by |dispatcher_|. |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 DISALLOW_COPY_AND_ASSIGN(NativeDisplayEventDispatcherX11Test); | 132 DISALLOW_COPY_AND_ASSIGN(NativeDisplayEventDispatcherX11Test); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 NativeDisplayEventDispatcherX11Test::NativeDisplayEventDispatcherX11Test() | 135 NativeDisplayEventDispatcherX11Test::NativeDisplayEventDispatcherX11Test() |
| 136 : xrandr_event_base_(10), | 136 : xrandr_event_base_(10), |
| 137 helper_delegate_(new TestHelperDelegate()), | 137 helper_delegate_(new TestHelperDelegate()), |
| 138 dispatcher_(new NativeDisplayEventDispatcherX11(helper_delegate_.get(), | 138 dispatcher_(new NativeDisplayEventDispatcherX11(helper_delegate_.get(), |
| 139 xrandr_event_base_)), | 139 xrandr_event_base_)), |
| 140 test_tick_clock_(new base::SimpleTestTickClock) { | 140 test_tick_clock_(new base::SimpleTestTickClock) { |
| 141 test_tick_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); | 141 test_tick_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); |
| 142 dispatcher_->SetTickClockForTest( | 142 dispatcher_->SetTickClockForTest( |
| 143 scoped_ptr<base::TickClock>(test_tick_clock_)); | 143 std::unique_ptr<base::TickClock>(test_tick_clock_)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 NativeDisplayEventDispatcherX11Test::~NativeDisplayEventDispatcherX11Test() {} | 146 NativeDisplayEventDispatcherX11Test::~NativeDisplayEventDispatcherX11Test() {} |
| 147 | 147 |
| 148 void NativeDisplayEventDispatcherX11Test::DispatchScreenChangeEvent() { | 148 void NativeDisplayEventDispatcherX11Test::DispatchScreenChangeEvent() { |
| 149 XRRScreenChangeNotifyEvent event = {0}; | 149 XRRScreenChangeNotifyEvent event = {0}; |
| 150 event.type = xrandr_event_base_ + RRScreenChangeNotify; | 150 event.type = xrandr_event_base_ + RRScreenChangeNotify; |
| 151 | 151 |
| 152 dispatcher_->DispatchEvent(reinterpret_cast<const PlatformEvent>(&event)); | 152 dispatcher_->DispatchEvent(reinterpret_cast<const PlatformEvent>(&event)); |
| 153 } | 153 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 outputs.clear(); | 321 outputs.clear(); |
| 322 outputs.push_back(CreateOutput(0, DISPLAY_CONNECTION_TYPE_UNKNOWN, 2, 11)); | 322 outputs.push_back(CreateOutput(0, DISPLAY_CONNECTION_TYPE_UNKNOWN, 2, 11)); |
| 323 helper_delegate_->set_cached_outputs(outputs.get()); | 323 helper_delegate_->set_cached_outputs(outputs.get()); |
| 324 | 324 |
| 325 // External display should be updated if the id is zero. | 325 // External display should be updated if the id is zero. |
| 326 DispatchOutputChangeEvent(2, 11, 20, true); | 326 DispatchOutputChangeEvent(2, 11, 20, true); |
| 327 EXPECT_EQ(1, helper_delegate_->num_calls_notify_observers()); | 327 EXPECT_EQ(1, helper_delegate_->num_calls_notify_observers()); |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace ui | 330 } // namespace ui |
| OLD | NEW |