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

Side by Side Diff: ui/ozone/platform/dri/screen_manager_unittest.cc

Issue 548613002: Revert of [Ozone-GBM] Handle GPU crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/ozone/platform/dri/screen_manager.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 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/ozone/platform/dri/dri_buffer.h" 6 #include "ui/ozone/platform/dri/dri_buffer.h"
7 #include "ui/ozone/platform/dri/hardware_display_controller.h" 7 #include "ui/ozone/platform/dri/hardware_display_controller.h"
8 #include "ui/ozone/platform/dri/screen_manager.h" 8 #include "ui/ozone/platform/dri/screen_manager.h"
9 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h" 9 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h"
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 private: 69 private:
70 DISALLOW_COPY_AND_ASSIGN(ScreenManagerTest); 70 DISALLOW_COPY_AND_ASSIGN(ScreenManagerTest);
71 }; 71 };
72 72
73 TEST_F(ScreenManagerTest, CheckWithNoControllers) { 73 TEST_F(ScreenManagerTest, CheckWithNoControllers) {
74 EXPECT_FALSE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 74 EXPECT_FALSE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
75 } 75 }
76 76
77 TEST_F(ScreenManagerTest, CheckWithValidController) { 77 TEST_F(ScreenManagerTest, CheckWithValidController) {
78 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
79 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 78 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
80 kPrimaryConnector, 79 kPrimaryConnector,
81 GetPrimaryBounds().origin(), 80 GetPrimaryBounds().origin(),
82 kDefaultMode); 81 kDefaultMode);
83 base::WeakPtr<ui::HardwareDisplayController> controller = 82 base::WeakPtr<ui::HardwareDisplayController> controller =
84 screen_manager_->GetDisplayController(GetPrimaryBounds()); 83 screen_manager_->GetDisplayController(GetPrimaryBounds());
85 84
86 EXPECT_TRUE(controller); 85 EXPECT_TRUE(controller);
87 EXPECT_TRUE(controller->HasCrtc(kPrimaryCrtc)); 86 EXPECT_TRUE(controller->HasCrtc(kPrimaryCrtc));
88 } 87 }
89 88
90 TEST_F(ScreenManagerTest, CheckWithInvalidBounds) { 89 TEST_F(ScreenManagerTest, CheckWithInvalidBounds) {
91 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
92 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 90 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
93 kPrimaryConnector, 91 kPrimaryConnector,
94 GetPrimaryBounds().origin(), 92 GetPrimaryBounds().origin(),
95 kDefaultMode); 93 kDefaultMode);
96 94
97 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 95 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
98 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 96 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
99 } 97 }
100 98
101 TEST_F(ScreenManagerTest, CheckForSecondValidController) { 99 TEST_F(ScreenManagerTest, CheckForSecondValidController) {
102 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
103 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 100 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
104 kPrimaryConnector, 101 kPrimaryConnector,
105 GetPrimaryBounds().origin(), 102 GetPrimaryBounds().origin(),
106 kDefaultMode); 103 kDefaultMode);
107 screen_manager_->AddDisplayController(kSecondaryCrtc, kSecondaryConnector); 104 screen_manager_->ConfigureDisplayController(
108 screen_manager_->ConfigureDisplayController(kSecondaryCrtc, 105 3, 4, GetSecondaryBounds().origin(), kDefaultMode);
109 kSecondaryConnector,
110 GetSecondaryBounds().origin(),
111 kDefaultMode);
112 106
113 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 107 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
114 EXPECT_TRUE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 108 EXPECT_TRUE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
115 } 109 }
116 110
117 TEST_F(ScreenManagerTest, CheckControllerAfterItIsRemoved) { 111 TEST_F(ScreenManagerTest, CheckControllerAfterItIsRemoved) {
118 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
119 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 112 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
120 kPrimaryConnector, 113 kPrimaryConnector,
121 GetPrimaryBounds().origin(), 114 GetPrimaryBounds().origin(),
122 kDefaultMode); 115 kDefaultMode);
123 base::WeakPtr<ui::HardwareDisplayController> controller = 116 base::WeakPtr<ui::HardwareDisplayController> controller =
124 screen_manager_->GetDisplayController(GetPrimaryBounds()); 117 screen_manager_->GetDisplayController(GetPrimaryBounds());
125 118
126 EXPECT_TRUE(controller); 119 EXPECT_TRUE(controller);
127 screen_manager_->RemoveDisplayController(kPrimaryCrtc); 120 screen_manager_->RemoveDisplayController(kPrimaryCrtc);
128 EXPECT_FALSE(controller); 121 EXPECT_FALSE(controller);
129 } 122 }
130 123
131 TEST_F(ScreenManagerTest, CheckDuplicateConfiguration) { 124 TEST_F(ScreenManagerTest, CheckDuplicateConfiguration) {
132 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
133 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 125 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
134 kPrimaryConnector, 126 kPrimaryConnector,
135 GetPrimaryBounds().origin(), 127 GetPrimaryBounds().origin(),
136 kDefaultMode); 128 kDefaultMode);
137 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 129 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
138 kPrimaryConnector, 130 kPrimaryConnector,
139 GetPrimaryBounds().origin(), 131 GetPrimaryBounds().origin(),
140 kDefaultMode); 132 kDefaultMode);
141 133
142 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 134 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
143 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 135 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
144 } 136 }
145 137
146 TEST_F(ScreenManagerTest, CheckChangingMode) { 138 TEST_F(ScreenManagerTest, CheckChangingMode) {
147 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
148 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 139 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
149 kPrimaryConnector, 140 kPrimaryConnector,
150 GetPrimaryBounds().origin(), 141 GetPrimaryBounds().origin(),
151 kDefaultMode); 142 kDefaultMode);
152 drmModeModeInfo new_mode = kDefaultMode; 143 drmModeModeInfo new_mode = kDefaultMode;
153 new_mode.vdisplay = 10; 144 new_mode.vdisplay = 10;
154 screen_manager_->ConfigureDisplayController( 145 screen_manager_->ConfigureDisplayController(
155 kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), new_mode); 146 kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), new_mode);
156 147
157 gfx::Rect new_bounds(0, 0, new_mode.hdisplay, new_mode.vdisplay); 148 gfx::Rect new_bounds(0, 0, new_mode.hdisplay, new_mode.vdisplay);
158 EXPECT_TRUE(screen_manager_->GetDisplayController(new_bounds)); 149 EXPECT_TRUE(screen_manager_->GetDisplayController(new_bounds));
159 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 150 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
160 drmModeModeInfo mode = 151 drmModeModeInfo mode =
161 screen_manager_->GetDisplayController(new_bounds)->get_mode(); 152 screen_manager_->GetDisplayController(new_bounds)->get_mode();
162 EXPECT_EQ(new_mode.vdisplay, mode.vdisplay); 153 EXPECT_EQ(new_mode.vdisplay, mode.vdisplay);
163 EXPECT_EQ(new_mode.hdisplay, mode.hdisplay); 154 EXPECT_EQ(new_mode.hdisplay, mode.hdisplay);
164 } 155 }
165 156
166 TEST_F(ScreenManagerTest, CheckForControllersInMirroredMode) { 157 TEST_F(ScreenManagerTest, CheckForControllersInMirroredMode) {
167 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
168 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 158 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
169 kPrimaryConnector, 159 kPrimaryConnector,
170 GetPrimaryBounds().origin(), 160 GetPrimaryBounds().origin(),
171 kDefaultMode); 161 kDefaultMode);
172 screen_manager_->AddDisplayController(kSecondaryCrtc, kSecondaryConnector);
173 screen_manager_->ConfigureDisplayController(kSecondaryCrtc, 162 screen_manager_->ConfigureDisplayController(kSecondaryCrtc,
174 kSecondaryConnector, 163 kSecondaryConnector,
175 GetPrimaryBounds().origin(), 164 GetPrimaryBounds().origin(),
176 kDefaultMode); 165 kDefaultMode);
177 166
178 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 167 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
179 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 168 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
180 } 169 }
181 170
182 TEST_F(ScreenManagerTest, CheckMirrorModeTransitions) { 171 TEST_F(ScreenManagerTest, CheckMirrorModeTransitions) {
183 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
184 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 172 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
185 kPrimaryConnector, 173 kPrimaryConnector,
186 GetPrimaryBounds().origin(), 174 GetPrimaryBounds().origin(),
187 kDefaultMode); 175 kDefaultMode);
188 screen_manager_->AddDisplayController(kSecondaryCrtc, kSecondaryConnector);
189 screen_manager_->ConfigureDisplayController(kSecondaryCrtc, 176 screen_manager_->ConfigureDisplayController(kSecondaryCrtc,
190 kSecondaryConnector, 177 kSecondaryConnector,
191 GetSecondaryBounds().origin(), 178 GetSecondaryBounds().origin(),
192 kDefaultMode); 179 kDefaultMode);
193 180
194 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 181 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
195 EXPECT_TRUE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 182 EXPECT_TRUE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
196 183
197 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 184 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
198 kPrimaryConnector, 185 kPrimaryConnector,
(...skipping 12 matching lines...) Expand all
211 kDefaultMode); 198 kDefaultMode);
212 screen_manager_->ConfigureDisplayController(kSecondaryCrtc, 199 screen_manager_->ConfigureDisplayController(kSecondaryCrtc,
213 kSecondaryConnector, 200 kSecondaryConnector,
214 GetPrimaryBounds().origin(), 201 GetPrimaryBounds().origin(),
215 kDefaultMode); 202 kDefaultMode);
216 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 203 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
217 EXPECT_TRUE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 204 EXPECT_TRUE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
218 } 205 }
219 206
220 TEST_F(ScreenManagerTest, MonitorGoneInMirrorMode) { 207 TEST_F(ScreenManagerTest, MonitorGoneInMirrorMode) {
221 screen_manager_->AddDisplayController(kPrimaryCrtc, kPrimaryConnector);
222 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 208 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
223 kPrimaryConnector, 209 kPrimaryConnector,
224 GetPrimaryBounds().origin(), 210 GetPrimaryBounds().origin(),
225 kDefaultMode); 211 kDefaultMode);
226 screen_manager_->AddDisplayController(kSecondaryCrtc, kSecondaryConnector);
227 screen_manager_->ConfigureDisplayController(kSecondaryCrtc, 212 screen_manager_->ConfigureDisplayController(kSecondaryCrtc,
228 kSecondaryConnector, 213 kSecondaryConnector,
229 GetPrimaryBounds().origin(), 214 GetPrimaryBounds().origin(),
230 kDefaultMode); 215 kDefaultMode);
231 216
232 screen_manager_->RemoveDisplayController(kSecondaryCrtc); 217 screen_manager_->RemoveDisplayController(kSecondaryCrtc);
233 EXPECT_TRUE( 218 EXPECT_TRUE(
234 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 219 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
235 kPrimaryConnector, 220 kPrimaryConnector,
236 GetPrimaryBounds().origin(), 221 GetPrimaryBounds().origin(),
237 kDefaultMode)); 222 kDefaultMode));
238 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 223 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
239 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 224 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
240 } 225 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698