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

Side by Side Diff: ash/screen_util_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « ash/screen_util.cc ('k') | ash/screenshot_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/screen_util.h" 5 #include "ash/screen_util.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_md_test_base.h" 9 #include "ash/test/ash_md_test_base.h"
10 #include "ash/test/display_manager_test_api.h" 10 #include "ash/test/display_manager_test_api.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 gfx::Rect(0, 0, 600, 553 + height_offset).ToString(), 45 gfx::Rect(0, 0, 600, 553 + height_offset).ToString(),
46 ScreenUtil::GetMaximizedWindowBoundsInParent(primary->GetNativeView()) 46 ScreenUtil::GetMaximizedWindowBoundsInParent(primary->GetNativeView())
47 .ToString()); 47 .ToString());
48 EXPECT_EQ( 48 EXPECT_EQ(
49 gfx::Rect(0, 0, 500, 453 + height_offset).ToString(), 49 gfx::Rect(0, 0, 500, 453 + height_offset).ToString(),
50 ScreenUtil::GetMaximizedWindowBoundsInParent(secondary->GetNativeView()) 50 ScreenUtil::GetMaximizedWindowBoundsInParent(secondary->GetNativeView())
51 .ToString()); 51 .ToString());
52 52
53 // Display bounds 53 // Display bounds
54 EXPECT_EQ("0,0 600x600", 54 EXPECT_EQ("0,0 600x600",
55 ScreenUtil::GetDisplayBoundsInParent( 55 ScreenUtil::GetDisplayBoundsInParent(primary->GetNativeView())
56 primary->GetNativeView()).ToString()); 56 .ToString());
57 EXPECT_EQ("0,0 500x500", 57 EXPECT_EQ("0,0 500x500",
58 ScreenUtil::GetDisplayBoundsInParent( 58 ScreenUtil::GetDisplayBoundsInParent(secondary->GetNativeView())
59 secondary->GetNativeView()).ToString()); 59 .ToString());
60 60
61 // Work area bounds 61 // Work area bounds
62 EXPECT_EQ( 62 EXPECT_EQ(
63 gfx::Rect(0, 0, 600, 553 + height_offset).ToString(), 63 gfx::Rect(0, 0, 600, 553 + height_offset).ToString(),
64 ScreenUtil::GetDisplayWorkAreaBoundsInParent(primary->GetNativeView()) 64 ScreenUtil::GetDisplayWorkAreaBoundsInParent(primary->GetNativeView())
65 .ToString()); 65 .ToString());
66 EXPECT_EQ( 66 EXPECT_EQ(
67 gfx::Rect(0, 0, 500, 453 + height_offset).ToString(), 67 gfx::Rect(0, 0, 500, 453 + height_offset).ToString(),
68 ScreenUtil::GetDisplayWorkAreaBoundsInParent(secondary->GetNativeView()) 68 ScreenUtil::GetDisplayWorkAreaBoundsInParent(secondary->GetNativeView())
69 .ToString()); 69 .ToString());
70 } 70 }
71 71
72 // Test verifies a stable handling of secondary screen widget changes 72 // Test verifies a stable handling of secondary screen widget changes
73 // (crbug.com/226132). 73 // (crbug.com/226132).
74 TEST_P(ScreenUtilTest, StabilityTest) { 74 TEST_P(ScreenUtilTest, StabilityTest) {
75 if (!SupportsMultipleDisplays()) 75 if (!SupportsMultipleDisplays())
76 return; 76 return;
77 77
78 UpdateDisplay("600x600,500x500"); 78 UpdateDisplay("600x600,500x500");
79 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( 79 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds(
80 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); 80 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100));
81 EXPECT_EQ(Shell::GetAllRootWindows()[1], 81 EXPECT_EQ(Shell::GetAllRootWindows()[1],
82 secondary->GetNativeView()->GetRootWindow()); 82 secondary->GetNativeView()->GetRootWindow());
83 secondary->Show(); 83 secondary->Show();
84 secondary->Maximize(); 84 secondary->Maximize();
85 secondary->Show(); 85 secondary->Show();
86 secondary->SetFullscreen(true); 86 secondary->SetFullscreen(true);
87 secondary->Hide(); 87 secondary->Hide();
88 secondary->Close(); 88 secondary->Close();
89 } 89 }
90 90
91 TEST_P(ScreenUtilTest, ConvertRect) { 91 TEST_P(ScreenUtilTest, ConvertRect) {
92 if (!SupportsMultipleDisplays()) 92 if (!SupportsMultipleDisplays())
93 return; 93 return;
94 94
95 UpdateDisplay("600x600,500x500"); 95 UpdateDisplay("600x600,500x500");
96 96
97 views::Widget* primary = views::Widget::CreateWindowWithContextAndBounds( 97 views::Widget* primary = views::Widget::CreateWindowWithContextAndBounds(
98 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); 98 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100));
99 primary->Show(); 99 primary->Show();
100 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( 100 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds(
101 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); 101 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100));
102 secondary->Show(); 102 secondary->Show();
103 103
104 EXPECT_EQ( 104 EXPECT_EQ("0,0 100x100",
105 "0,0 100x100", 105 ScreenUtil::ConvertRectFromScreen(primary->GetNativeView(),
106 ScreenUtil::ConvertRectFromScreen( 106 gfx::Rect(10, 10, 100, 100))
107 primary->GetNativeView(), gfx::Rect(10, 10, 100, 100)).ToString()); 107 .ToString());
108 EXPECT_EQ( 108 EXPECT_EQ("10,10 100x100",
109 "10,10 100x100", 109 ScreenUtil::ConvertRectFromScreen(secondary->GetNativeView(),
110 ScreenUtil::ConvertRectFromScreen( 110 gfx::Rect(620, 20, 100, 100))
111 secondary->GetNativeView(), gfx::Rect(620, 20, 100, 100)).ToString()); 111 .ToString());
112 112
113 EXPECT_EQ( 113 EXPECT_EQ("40,40 100x100",
114 "40,40 100x100", 114 ScreenUtil::ConvertRectToScreen(primary->GetNativeView(),
115 ScreenUtil::ConvertRectToScreen( 115 gfx::Rect(30, 30, 100, 100))
116 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); 116 .ToString());
117 EXPECT_EQ( 117 EXPECT_EQ("650,50 100x100",
118 "650,50 100x100", 118 ScreenUtil::ConvertRectToScreen(secondary->GetNativeView(),
119 ScreenUtil::ConvertRectToScreen( 119 gfx::Rect(40, 40, 100, 100))
120 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); 120 .ToString());
121 } 121 }
122 122
123 TEST_P(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { 123 TEST_P(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) {
124 if (!SupportsMultipleDisplays()) 124 if (!SupportsMultipleDisplays())
125 return; 125 return;
126 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 126 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
127 127
128 display_manager->SetUnifiedDesktopEnabled(true); 128 display_manager->SetUnifiedDesktopEnabled(true);
129 129
130 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( 130 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
(...skipping 19 matching lines...) Expand all
150 .ToString()); 150 .ToString());
151 151
152 UpdateDisplay("600x500"); 152 UpdateDisplay("600x500");
153 EXPECT_EQ("0,0 600x500", 153 EXPECT_EQ("0,0 600x500",
154 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow()) 154 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow())
155 .ToString()); 155 .ToString());
156 } 156 }
157 157
158 } // namespace test 158 } // namespace test
159 } // namespace ash 159 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screen_util.cc ('k') | ash/screenshot_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698