OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/views/widget/desktop_aura/desktop_screen_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
14 #include "ui/aura/window_event_dispatcher.h" | 15 #include "ui/aura/window_event_dispatcher.h" |
15 #include "ui/base/hit_test.h" | 16 #include "ui/base/hit_test.h" |
16 #include "ui/base/x/x11_util.h" | 17 #include "ui/base/x/x11_util.h" |
17 #include "ui/events/test/event_generator.h" | 18 #include "ui/events/test/event_generator.h" |
18 #include "ui/gfx/display_observer.h" | 19 #include "ui/gfx/display_observer.h" |
19 #include "ui/gfx/font_render_params.h" | 20 #include "ui/gfx/font_render_params.h" |
20 #include "ui/gfx/x/x11_types.h" | 21 #include "ui/gfx/x/x11_types.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 123 |
123 void OnDisplayRemoved(const gfx::Display& old_display) override { | 124 void OnDisplayRemoved(const gfx::Display& old_display) override { |
124 removed_display_.push_back(old_display); | 125 removed_display_.push_back(old_display); |
125 } | 126 } |
126 | 127 |
127 void OnDisplayMetricsChanged(const gfx::Display& display, | 128 void OnDisplayMetricsChanged(const gfx::Display& display, |
128 uint32_t metrics) override { | 129 uint32_t metrics) override { |
129 changed_display_.push_back(display); | 130 changed_display_.push_back(display); |
130 } | 131 } |
131 | 132 |
132 scoped_ptr<DesktopScreenX11> screen_; | 133 std::unique_ptr<DesktopScreenX11> screen_; |
133 | 134 |
134 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11Test); | 135 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11Test); |
135 }; | 136 }; |
136 | 137 |
137 TEST_F(DesktopScreenX11Test, BoundsChangeSingleMonitor) { | 138 TEST_F(DesktopScreenX11Test, BoundsChangeSingleMonitor) { |
138 std::vector<gfx::Display> displays; | 139 std::vector<gfx::Display> displays; |
139 displays.push_back(gfx::Display(kFirstDisplay, gfx::Rect(0, 0, 1024, 768))); | 140 displays.push_back(gfx::Display(kFirstDisplay, gfx::Rect(0, 0, 1024, 768))); |
140 NotifyDisplaysChanged(displays); | 141 NotifyDisplaysChanged(displays); |
141 | 142 |
142 EXPECT_EQ(1u, changed_display_.size()); | 143 EXPECT_EQ(1u, changed_display_.size()); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 EXPECT_EQ(2u, changed_display_.size()); | 457 EXPECT_EQ(2u, changed_display_.size()); |
457 | 458 |
458 displays[0].set_device_scale_factor(1.f); | 459 displays[0].set_device_scale_factor(1.f); |
459 displays[1].set_device_scale_factor(1.f); | 460 displays[1].set_device_scale_factor(1.f); |
460 NotifyDisplaysChanged(displays); | 461 NotifyDisplaysChanged(displays); |
461 EXPECT_EQ(4u, changed_display_.size()); | 462 EXPECT_EQ(4u, changed_display_.size()); |
462 EXPECT_EQ(1.f, gfx::GetFontRenderParamsDeviceScaleFactor()); | 463 EXPECT_EQ(1.f, gfx::GetFontRenderParamsDeviceScaleFactor()); |
463 } | 464 } |
464 | 465 |
465 } // namespace views | 466 } // namespace views |
OLD | NEW |