| 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 "ui/display/win/screen_win.h" | 5 #include "ui/display/win/screen_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <inttypes.h> | 8 #include <inttypes.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 EXPECT_EQ(1.0, ScreenWin::GetScaleFactorForHWND(GetFakeHwnd())); | 346 EXPECT_EQ(1.0, ScreenWin::GetScaleFactorForHWND(GetFakeHwnd())); |
| 347 } | 347 } |
| 348 | 348 |
| 349 TEST_F(ScreenWinTestSingleDisplay1x, GetDisplays) { | 349 TEST_F(ScreenWinTestSingleDisplay1x, GetDisplays) { |
| 350 std::vector<Display> displays = GetScreen()->GetAllDisplays(); | 350 std::vector<Display> displays = GetScreen()->GetAllDisplays(); |
| 351 ASSERT_EQ(1u, displays.size()); | 351 ASSERT_EQ(1u, displays.size()); |
| 352 EXPECT_EQ(gfx::Rect(0, 0, 1920, 1200), displays[0].bounds()); | 352 EXPECT_EQ(gfx::Rect(0, 0, 1920, 1200), displays[0].bounds()); |
| 353 EXPECT_EQ(gfx::Rect(0, 0, 1920, 1100), displays[0].work_area()); | 353 EXPECT_EQ(gfx::Rect(0, 0, 1920, 1100), displays[0].work_area()); |
| 354 } | 354 } |
| 355 | 355 |
| 356 TEST_F(ScreenWinTestSingleDisplay1x, GetDisplayById) { |
| 357 Screen* screen = GetScreen(); |
| 358 int64_t primary_display_id = screen->GetPrimaryDisplay().id(); |
| 359 Display display; |
| 360 bool has_display = |
| 361 screen->GetDisplayWithDisplayId(primary_display_id, &display); |
| 362 EXPECT_TRUE(has_display); |
| 363 EXPECT_EQ(screen->GetPrimaryDisplay(), display); |
| 364 } |
| 365 |
| 356 TEST_F(ScreenWinTestSingleDisplay1x, GetNumDisplays) { | 366 TEST_F(ScreenWinTestSingleDisplay1x, GetNumDisplays) { |
| 357 EXPECT_EQ(1, GetScreen()->GetNumDisplays()); | 367 EXPECT_EQ(1, GetScreen()->GetNumDisplays()); |
| 358 } | 368 } |
| 359 | 369 |
| 360 TEST_F(ScreenWinTestSingleDisplay1x, GetDisplayNearestWindowPrimaryDisplay) { | 370 TEST_F(ScreenWinTestSingleDisplay1x, GetDisplayNearestWindowPrimaryDisplay) { |
| 361 Screen* screen = GetScreen(); | 371 Screen* screen = GetScreen(); |
| 362 EXPECT_EQ(screen->GetPrimaryDisplay(), | 372 EXPECT_EQ(screen->GetPrimaryDisplay(), |
| 363 screen->GetDisplayNearestWindow(nullptr)); | 373 screen->GetDisplayNearestWindow(nullptr)); |
| 364 } | 374 } |
| 365 | 375 |
| (...skipping 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3599 // this test is to make sure we don't crash. | 3609 // this test is to make sure we don't crash. |
| 3600 ScreenWin::GetSystemMetricsInDIP(SM_CXSIZEFRAME); | 3610 ScreenWin::GetSystemMetricsInDIP(SM_CXSIZEFRAME); |
| 3601 } | 3611 } |
| 3602 | 3612 |
| 3603 TEST_F(ScreenWinUninitializedForced2x, GetScaleFactorForHWND) { | 3613 TEST_F(ScreenWinUninitializedForced2x, GetScaleFactorForHWND) { |
| 3604 EXPECT_EQ(2.0, ScreenWin::GetScaleFactorForHWND(nullptr)); | 3614 EXPECT_EQ(2.0, ScreenWin::GetScaleFactorForHWND(nullptr)); |
| 3605 } | 3615 } |
| 3606 | 3616 |
| 3607 } // namespace win | 3617 } // namespace win |
| 3608 } // namespace display | 3618 } // namespace display |
| OLD | NEW |