| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 gfx::Rect(640, 0, 1024, 768))); | 306 gfx::Rect(640, 0, 1024, 768))); |
| 307 displays.push_back(gfx::Display(kSecondDisplay, gfx::Rect(0, 0, 640, 480))); | 307 displays.push_back(gfx::Display(kSecondDisplay, gfx::Rect(0, 0, 640, 480))); |
| 308 screen()->ProcessDisplayChange(displays); | 308 screen()->ProcessDisplayChange(displays); |
| 309 | 309 |
| 310 // The first display in the list is always the primary, even if other | 310 // The first display in the list is always the primary, even if other |
| 311 // displays are to the left in screen layout. | 311 // displays are to the left in screen layout. |
| 312 EXPECT_EQ(kFirstDisplay, screen()->GetPrimaryDisplay().id()); | 312 EXPECT_EQ(kFirstDisplay, screen()->GetPrimaryDisplay().id()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 TEST_F(DesktopScreenX11Test, GetWindowAtScreenPoint) { | 315 TEST_F(DesktopScreenX11Test, GetWindowAtScreenPoint) { |
| 316 if (!ui::WmSupportsHint(ui::GetAtom("_NET_ACTIVE_WINDOW"))) |
| 317 return; |
| 318 |
| 316 Widget* window_one = BuildTopLevelDesktopWidget(gfx::Rect(110, 110, 10, 10), | 319 Widget* window_one = BuildTopLevelDesktopWidget(gfx::Rect(110, 110, 10, 10), |
| 317 false); | 320 false); |
| 318 Widget* window_two = BuildTopLevelDesktopWidget(gfx::Rect(150, 150, 10, 10), | 321 Widget* window_two = BuildTopLevelDesktopWidget(gfx::Rect(150, 150, 10, 10), |
| 319 false); | 322 false); |
| 320 Widget* window_three = | 323 Widget* window_three = |
| 321 BuildTopLevelDesktopWidget(gfx::Rect(115, 115, 20, 20), false); | 324 BuildTopLevelDesktopWidget(gfx::Rect(115, 115, 20, 20), false); |
| 322 | 325 |
| 323 window_three->Show(); | 326 window_three->Show(); |
| 324 window_two->Show(); | 327 window_two->Show(); |
| 325 window_one->Show(); | 328 window_one->Show(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 EXPECT_EQ( | 371 EXPECT_EQ( |
| 369 kSecondDisplay, | 372 kSecondDisplay, |
| 370 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); | 373 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); |
| 371 | 374 |
| 372 window_one->CloseNow(); | 375 window_one->CloseNow(); |
| 373 window_two->CloseNow(); | 376 window_two->CloseNow(); |
| 374 } | 377 } |
| 375 | 378 |
| 376 // Tests that the window is maximized in response to a double click event. | 379 // Tests that the window is maximized in response to a double click event. |
| 377 TEST_F(DesktopScreenX11Test, DoubleClickHeaderMaximizes) { | 380 TEST_F(DesktopScreenX11Test, DoubleClickHeaderMaximizes) { |
| 381 if (!ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"))) |
| 382 return; |
| 383 |
| 378 Widget* widget = BuildTopLevelDesktopWidget(gfx::Rect(0, 0, 100, 100), true); | 384 Widget* widget = BuildTopLevelDesktopWidget(gfx::Rect(0, 0, 100, 100), true); |
| 379 widget->Show(); | 385 widget->Show(); |
| 380 TestDesktopNativeWidgetAura* native_widget = | 386 TestDesktopNativeWidgetAura* native_widget = |
| 381 static_cast<TestDesktopNativeWidgetAura*>(widget->native_widget()); | 387 static_cast<TestDesktopNativeWidgetAura*>(widget->native_widget()); |
| 382 native_widget->set_window_component(HTCAPTION); | 388 native_widget->set_window_component(HTCAPTION); |
| 383 | 389 |
| 384 aura::Window* window = widget->GetNativeWindow(); | 390 aura::Window* window = widget->GetNativeWindow(); |
| 385 window->SetProperty(aura::client::kCanMaximizeKey, true); | 391 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 386 | 392 |
| 387 // Cast to superclass as DesktopWindowTreeHostX11 hide IsMaximized | 393 // Cast to superclass as DesktopWindowTreeHostX11 hide IsMaximized |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 screen()->ProcessDisplayChange(displays); | 549 screen()->ProcessDisplayChange(displays); |
| 544 EXPECT_EQ(2u, changed_display_.size()); | 550 EXPECT_EQ(2u, changed_display_.size()); |
| 545 | 551 |
| 546 displays[0].set_device_scale_factor(1.f); | 552 displays[0].set_device_scale_factor(1.f); |
| 547 displays[1].set_device_scale_factor(1.f); | 553 displays[1].set_device_scale_factor(1.f); |
| 548 screen()->ProcessDisplayChange(displays); | 554 screen()->ProcessDisplayChange(displays); |
| 549 EXPECT_EQ(4u, changed_display_.size()); | 555 EXPECT_EQ(4u, changed_display_.size()); |
| 550 } | 556 } |
| 551 | 557 |
| 552 } // namespace views | 558 } // namespace views |
| OLD | NEW |