| 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> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 12 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 #include "ui/aura/window_event_dispatcher.h" | 16 #include "ui/aura/window_event_dispatcher.h" |
| 17 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
| 18 #include "ui/base/x/x11_util.h" | |
| 19 #include "ui/display/display_observer.h" | 18 #include "ui/display/display_observer.h" |
| 20 #include "ui/events/test/event_generator.h" | 19 #include "ui/events/test/event_generator.h" |
| 21 #include "ui/gfx/font_render_params.h" | 20 #include "ui/gfx/font_render_params.h" |
| 21 #include "ui/gfx/x/x11_atom_cache.h" |
| 22 #include "ui/gfx/x/x11_types.h" | 22 #include "ui/gfx/x/x11_types.h" |
| 23 #include "ui/views/test/views_test_base.h" | 23 #include "ui/views/test/views_test_base.h" |
| 24 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 24 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 25 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 25 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // Class which allows for the designation of non-client component targets of | 29 // Class which allows for the designation of non-client component targets of |
| 30 // hit tests. | 30 // hit tests. |
| 31 class TestDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura { | 31 class TestDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 EXPECT_EQ( | 297 EXPECT_EQ( |
| 298 kSecondDisplay, | 298 kSecondDisplay, |
| 299 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); | 299 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); |
| 300 | 300 |
| 301 window_one->CloseNow(); | 301 window_one->CloseNow(); |
| 302 window_two->CloseNow(); | 302 window_two->CloseNow(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 // Tests that the window is maximized in response to a double click event. | 305 // Tests that the window is maximized in response to a double click event. |
| 306 TEST_F(DesktopScreenX11Test, DoubleClickHeaderMaximizes) { | 306 TEST_F(DesktopScreenX11Test, DoubleClickHeaderMaximizes) { |
| 307 if (!ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"))) | 307 if (!ui::WmSupportsHint(gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"))) |
| 308 return; | 308 return; |
| 309 | 309 |
| 310 Widget* widget = BuildTopLevelDesktopWidget(gfx::Rect(0, 0, 100, 100), true); | 310 Widget* widget = BuildTopLevelDesktopWidget(gfx::Rect(0, 0, 100, 100), true); |
| 311 widget->Show(); | 311 widget->Show(); |
| 312 TestDesktopNativeWidgetAura* native_widget = | 312 TestDesktopNativeWidgetAura* native_widget = |
| 313 static_cast<TestDesktopNativeWidgetAura*>(widget->native_widget()); | 313 static_cast<TestDesktopNativeWidgetAura*>(widget->native_widget()); |
| 314 native_widget->set_window_component(HTCAPTION); | 314 native_widget->set_window_component(HTCAPTION); |
| 315 | 315 |
| 316 aura::Window* window = widget->GetNativeWindow(); | 316 aura::Window* window = widget->GetNativeWindow(); |
| 317 window->SetProperty(aura::client::kResizeBehaviorKey, | 317 window->SetProperty(aura::client::kResizeBehaviorKey, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 EXPECT_EQ(2u, changed_display_.size()); | 486 EXPECT_EQ(2u, changed_display_.size()); |
| 487 | 487 |
| 488 displays[0].set_device_scale_factor(1.f); | 488 displays[0].set_device_scale_factor(1.f); |
| 489 displays[1].set_device_scale_factor(1.f); | 489 displays[1].set_device_scale_factor(1.f); |
| 490 NotifyDisplaysChanged(displays); | 490 NotifyDisplaysChanged(displays); |
| 491 EXPECT_EQ(4u, changed_display_.size()); | 491 EXPECT_EQ(4u, changed_display_.size()); |
| 492 EXPECT_EQ(1.f, gfx::GetFontRenderParamsDeviceScaleFactor()); | 492 EXPECT_EQ(1.f, gfx::GetFontRenderParamsDeviceScaleFactor()); |
| 493 } | 493 } |
| 494 | 494 |
| 495 } // namespace views | 495 } // namespace views |
| OLD | NEW |