Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: ui/display/win/screen_win_unittest.cc

Issue 2959423003: color: Read all displays' color profiles on Windows (Closed)
Patch Set: Remove unused Initialize method Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/win/screen_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 28
29 namespace display { 29 namespace display {
30 namespace win { 30 namespace win {
31 namespace { 31 namespace {
32 32
33 class TestScreenWin : public ScreenWin { 33 class TestScreenWin : public ScreenWin {
34 public: 34 public:
35 TestScreenWin(const std::vector<DisplayInfo>& display_infos, 35 TestScreenWin(const std::vector<DisplayInfo>& display_infos,
36 const std::vector<MONITORINFOEX>& monitor_infos, 36 const std::vector<MONITORINFOEX>& monitor_infos,
37 const std::unordered_map<HWND, gfx::Rect>& hwnd_map) 37 const std::unordered_map<HWND, gfx::Rect>& hwnd_map)
38 : monitor_infos_(monitor_infos), 38 : ScreenWin(false), monitor_infos_(monitor_infos), hwnd_map_(hwnd_map) {
39 hwnd_map_(hwnd_map) {
40 UpdateFromDisplayInfos(display_infos); 39 UpdateFromDisplayInfos(display_infos);
41 } 40 }
42 41
43 ~TestScreenWin() override = default; 42 ~TestScreenWin() override = default;
44 43
45 protected: 44 protected:
46 // win::ScreenWin: 45 // win::ScreenWin:
47 HWND GetHWNDFromNativeView(gfx::NativeView window) const override { 46 HWND GetHWNDFromNativeView(gfx::NativeView window) const override {
48 // NativeView is only used as an identifier in this tests, so interchange 47 // NativeView is only used as an identifier in this tests, so interchange
49 // NativeView with an HWND for convenience. 48 // NativeView with an HWND for convenience.
50 return reinterpret_cast<HWND>(window); 49 return reinterpret_cast<HWND>(window);
51 } 50 }
52 51
53 gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const override { 52 gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const override {
54 // NativeWindow is only used as an identifier in this tests, so interchange 53 // NativeWindow is only used as an identifier in this tests, so interchange
55 // an HWND for a NativeWindow for convenience. 54 // an HWND for a NativeWindow for convenience.
56 return reinterpret_cast<gfx::NativeWindow>(hwnd); 55 return reinterpret_cast<gfx::NativeWindow>(hwnd);
57 } 56 }
58 57
59 private: 58 private:
60 void Initialize() override {}
61
62 // Finding the corresponding monitor from a point is generally handled by 59 // Finding the corresponding monitor from a point is generally handled by
63 // Windows's MonitorFromPoint. This mocked function requires that the provided 60 // Windows's MonitorFromPoint. This mocked function requires that the provided
64 // point is contained entirely in the monitor. 61 // point is contained entirely in the monitor.
65 MONITORINFOEX MonitorInfoFromScreenPoint(const gfx::Point& screen_point) const 62 MONITORINFOEX MonitorInfoFromScreenPoint(const gfx::Point& screen_point) const
66 override { 63 override {
67 for (const MONITORINFOEX& monitor_info : monitor_infos_) { 64 for (const MONITORINFOEX& monitor_info : monitor_infos_) {
68 if (gfx::Rect(monitor_info.rcMonitor).Contains(screen_point)) 65 if (gfx::Rect(monitor_info.rcMonitor).Contains(screen_point))
69 return monitor_info; 66 return monitor_info;
70 } 67 }
71 NOTREACHED(); 68 NOTREACHED();
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after
3597 // this test is to make sure we don't crash. 3594 // this test is to make sure we don't crash.
3598 ScreenWin::GetSystemMetricsInDIP(SM_CXSIZEFRAME); 3595 ScreenWin::GetSystemMetricsInDIP(SM_CXSIZEFRAME);
3599 } 3596 }
3600 3597
3601 TEST_F(ScreenWinUninitializedForced2x, GetScaleFactorForHWND) { 3598 TEST_F(ScreenWinUninitializedForced2x, GetScaleFactorForHWND) {
3602 EXPECT_EQ(2.0, ScreenWin::GetScaleFactorForHWND(nullptr)); 3599 EXPECT_EQ(2.0, ScreenWin::GetScaleFactorForHWND(nullptr));
3603 } 3600 }
3604 3601
3605 } // namespace win 3602 } // namespace win
3606 } // namespace display 3603 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/win/screen_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698