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/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/gfx/display_observer.h" | 9 #include "ui/gfx/display_observer.h" |
10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // The first display in the list is always the primary, even if other | 196 // The first display in the list is always the primary, even if other |
197 // displays are to the left in screen layout. | 197 // displays are to the left in screen layout. |
198 EXPECT_EQ(kFirstDisplay, screen()->GetPrimaryDisplay().id()); | 198 EXPECT_EQ(kFirstDisplay, screen()->GetPrimaryDisplay().id()); |
199 } | 199 } |
200 | 200 |
201 TEST_F(DesktopScreenX11Test, GetWindowAtScreenPoint) { | 201 TEST_F(DesktopScreenX11Test, GetWindowAtScreenPoint) { |
202 Widget* window_one = BuildTopLevelDesktopWidget(gfx::Rect(10, 10, 10, 10)); | 202 Widget* window_one = BuildTopLevelDesktopWidget(gfx::Rect(10, 10, 10, 10)); |
203 Widget* window_two = BuildTopLevelDesktopWidget(gfx::Rect(50, 50, 10, 10)); | 203 Widget* window_two = BuildTopLevelDesktopWidget(gfx::Rect(50, 50, 10, 10)); |
204 Widget* window_three = BuildTopLevelDesktopWidget(gfx::Rect(15, 15, 20, 20)); | 204 Widget* window_three = BuildTopLevelDesktopWidget(gfx::Rect(15, 15, 20, 20)); |
205 | 205 |
206 // Make sure the internal state of DesktopRootWindowHostX11 is set up | 206 // Make sure the internal state of DesktopWindowTreeHostX11 is set up |
207 // correctly. | 207 // correctly. |
208 ASSERT_EQ(3u, DesktopRootWindowHostX11::GetAllOpenWindows().size()); | 208 ASSERT_EQ(3u, DesktopWindowTreeHostX11::GetAllOpenWindows().size()); |
209 | 209 |
210 EXPECT_EQ(window_one->GetNativeWindow(), | 210 EXPECT_EQ(window_one->GetNativeWindow(), |
211 screen()->GetWindowAtScreenPoint(gfx::Point(15, 15))); | 211 screen()->GetWindowAtScreenPoint(gfx::Point(15, 15))); |
212 EXPECT_EQ(window_two->GetNativeWindow(), | 212 EXPECT_EQ(window_two->GetNativeWindow(), |
213 screen()->GetWindowAtScreenPoint(gfx::Point(55, 55))); | 213 screen()->GetWindowAtScreenPoint(gfx::Point(55, 55))); |
214 EXPECT_EQ(NULL, | 214 EXPECT_EQ(NULL, |
215 screen()->GetWindowAtScreenPoint(gfx::Point(100, 100))); | 215 screen()->GetWindowAtScreenPoint(gfx::Point(100, 100))); |
216 | 216 |
217 // Bring the third window in front. It overlaps with the first window. | 217 // Bring the third window in front. It overlaps with the first window. |
218 // Hit-testing on the intersecting region should give the third window. | 218 // Hit-testing on the intersecting region should give the third window. |
(...skipping 21 matching lines...) Expand all Loading... |
240 screen()->GetDisplayNearestWindow(window_one->GetNativeWindow()).id()); | 240 screen()->GetDisplayNearestWindow(window_one->GetNativeWindow()).id()); |
241 EXPECT_EQ( | 241 EXPECT_EQ( |
242 kSecondDisplay, | 242 kSecondDisplay, |
243 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); | 243 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); |
244 | 244 |
245 window_one->CloseNow(); | 245 window_one->CloseNow(); |
246 window_two->CloseNow(); | 246 window_two->CloseNow(); |
247 } | 247 } |
248 | 248 |
249 } // namespace views | 249 } // namespace views |
OLD | NEW |