OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/test/ash_test_base.h" | 6 #include "ash/test/ash_test_base.h" |
7 #include "ui/aura/test/test_window_delegate.h" | 7 #include "ui/aura/test/test_window_delegate.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/display/manager/display_manager.h" | |
10 | 9 |
11 namespace ash { | 10 namespace ash { |
12 | 11 |
13 class ScreenAshTest : public test::AshTestBase { | 12 using ScreenAshTest = test::AshTestBase; |
14 public: | |
15 ScreenAshTest() {} | |
16 ~ScreenAshTest() override {} | |
17 | |
18 private: | |
19 DISALLOW_COPY_AND_ASSIGN(ScreenAshTest); | |
20 }; | |
21 | 13 |
22 // Tests that ScreenAsh::GetWindowAtScreenPoint() returns the correct window on | 14 // Tests that ScreenAsh::GetWindowAtScreenPoint() returns the correct window on |
23 // the correct display. | 15 // the correct display. |
24 TEST_F(ScreenAshTest, TestGetWindowAtScreenPoint) { | 16 TEST_F(ScreenAshTest, TestGetWindowAtScreenPoint) { |
25 UpdateDisplay("200x200,400x400"); | 17 UpdateDisplay("200x200,400x400"); |
26 | 18 |
27 aura::test::TestWindowDelegate delegate; | 19 aura::test::TestWindowDelegate delegate; |
28 std::unique_ptr<aura::Window> win1(CreateTestWindowInShellWithDelegate( | 20 std::unique_ptr<aura::Window> win1(CreateTestWindowInShellWithDelegate( |
29 &delegate, 0, gfx::Rect(0, 0, 200, 200))); | 21 &delegate, 0, gfx::Rect(0, 0, 200, 200))); |
30 | 22 |
31 std::unique_ptr<aura::Window> win2(CreateTestWindowInShellWithDelegate( | 23 std::unique_ptr<aura::Window> win2(CreateTestWindowInShellWithDelegate( |
32 &delegate, 1, gfx::Rect(200, 200, 100, 100))); | 24 &delegate, 1, gfx::Rect(200, 200, 100, 100))); |
33 | 25 |
34 ASSERT_NE(win1->GetRootWindow(), win2->GetRootWindow()); | 26 ASSERT_NE(win1->GetRootWindow(), win2->GetRootWindow()); |
35 | 27 |
36 EXPECT_EQ(win1.get(), display::Screen::GetScreen()->GetWindowAtScreenPoint( | 28 EXPECT_EQ(win1.get(), display::Screen::GetScreen()->GetWindowAtScreenPoint( |
37 gfx::Point(50, 60))); | 29 gfx::Point(50, 60))); |
38 EXPECT_EQ(win2.get(), display::Screen::GetScreen()->GetWindowAtScreenPoint( | 30 EXPECT_EQ(win2.get(), display::Screen::GetScreen()->GetWindowAtScreenPoint( |
39 gfx::Point(250, 260))); | 31 gfx::Point(250, 260))); |
40 } | 32 } |
41 | 33 |
42 } // namespace ash | 34 } // namespace ash |
OLD | NEW |