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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 | 321 |
322 window_three->Show(); | 322 window_three->Show(); |
323 window_two->Show(); | 323 window_two->Show(); |
324 window_one->Show(); | 324 window_one->Show(); |
325 | 325 |
326 // Make sure the internal state of DesktopWindowTreeHostX11 is set up | 326 // Make sure the internal state of DesktopWindowTreeHostX11 is set up |
327 // correctly. | 327 // correctly. |
328 ASSERT_EQ(3u, DesktopWindowTreeHostX11::GetAllOpenWindows().size()); | 328 ASSERT_EQ(3u, DesktopWindowTreeHostX11::GetAllOpenWindows().size()); |
329 | 329 |
330 EXPECT_EQ(window_one->GetNativeWindow(), | 330 EXPECT_EQ(window_one->GetNativeWindow(), |
331 screen()->GetWindowAtScreenPoint(gfx::Point(115, 115))); | 331 screen()->GetWindowAtScreenPoint(gfx::Point(117, 117))); |
pkotwicz
2014/05/16 16:56:56
The code now takes into account the fact that the
| |
332 EXPECT_EQ(window_two->GetNativeWindow(), | 332 EXPECT_EQ(window_two->GetNativeWindow(), |
333 screen()->GetWindowAtScreenPoint(gfx::Point(155, 155))); | 333 screen()->GetWindowAtScreenPoint(gfx::Point(155, 155))); |
334 EXPECT_EQ(NULL, | 334 EXPECT_EQ(NULL, |
335 screen()->GetWindowAtScreenPoint(gfx::Point(200, 200))); | 335 screen()->GetWindowAtScreenPoint(gfx::Point(200, 200))); |
336 | 336 |
337 // Bring the third window in front. It overlaps with the first window. | 337 // Bring the third window in front. It overlaps with the first window. |
338 // Hit-testing on the intersecting region should give the third window. | 338 // Hit-testing on the intersecting region should give the third window. |
339 ActivationWaiter activation_waiter(window_three); | 339 ActivationWaiter activation_waiter(window_three); |
340 window_three->Activate(); | 340 window_three->Activate(); |
341 activation_waiter.Wait(); | 341 activation_waiter.Wait(); |
342 | 342 |
343 EXPECT_EQ(window_three->GetNativeWindow(), | 343 EXPECT_EQ(window_three->GetNativeWindow(), |
344 screen()->GetWindowAtScreenPoint(gfx::Point(115, 115))); | 344 screen()->GetWindowAtScreenPoint(gfx::Point(117, 117))); |
345 | 345 |
346 window_one->CloseNow(); | 346 window_one->CloseNow(); |
347 window_two->CloseNow(); | 347 window_two->CloseNow(); |
348 window_three->CloseNow(); | 348 window_three->CloseNow(); |
349 } | 349 } |
350 | 350 |
351 TEST_F(DesktopScreenX11Test, GetDisplayNearestWindow) { | 351 TEST_F(DesktopScreenX11Test, GetDisplayNearestWindow) { |
352 // Set up a two monitor situation. | 352 // Set up a two monitor situation. |
353 std::vector<gfx::Display> displays; | 353 std::vector<gfx::Display> displays; |
354 displays.push_back(gfx::Display(kFirstDisplay, gfx::Rect(0, 0, 640, 480))); | 354 displays.push_back(gfx::Display(kFirstDisplay, gfx::Rect(0, 0, 640, 480))); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 generator.ReleaseRightButton(); | 449 generator.ReleaseRightButton(); |
450 EXPECT_FALSE(rwh->IsMaximized()); | 450 EXPECT_FALSE(rwh->IsMaximized()); |
451 generator.DoubleClickLeftButton(); | 451 generator.DoubleClickLeftButton(); |
452 RunPendingMessages(); | 452 RunPendingMessages(); |
453 EXPECT_FALSE(rwh->IsMaximized()); | 453 EXPECT_FALSE(rwh->IsMaximized()); |
454 | 454 |
455 widget->CloseNow(); | 455 widget->CloseNow(); |
456 } | 456 } |
457 | 457 |
458 } // namespace views | 458 } // namespace views |
OLD | NEW |