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

Side by Side Diff: ui/display/chromeos/update_display_configuration_task_unittest.cc

Issue 2407153008: Delete TestDisplaySnapshot and update tests. (Closed)
Patch Set: Rebase and cleanup. Created 4 years, 1 month 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/chromeos/test/test_display_snapshot.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 "ui/display/chromeos/update_display_configuration_task.h" 5 #include "ui/display/chromeos/update_display_configuration_task.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/display/chromeos/display_layout_manager.h" 17 #include "ui/display/chromeos/display_layout_manager.h"
18 #include "ui/display/chromeos/test/action_logger_util.h" 18 #include "ui/display/chromeos/test/action_logger_util.h"
19 #include "ui/display/chromeos/test/test_display_snapshot.h"
20 #include "ui/display/chromeos/test/test_native_display_delegate.h" 19 #include "ui/display/chromeos/test/test_native_display_delegate.h"
20 #include "ui/display/fake_display_snapshot.h"
21 21
22 namespace ui { 22 namespace ui {
23 namespace test { 23 namespace test {
24 24
25 namespace { 25 namespace {
26 26
27 class TestSoftwareMirroringController 27 class TestSoftwareMirroringController
28 : public DisplayConfigurator::SoftwareMirroringController { 28 : public DisplayConfigurator::SoftwareMirroringController {
29 public: 29 public:
30 TestSoftwareMirroringController() : is_enabled_(false) {} 30 TestSoftwareMirroringController() : is_enabled_(false) {}
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 class UpdateDisplayConfigurationTaskTest : public testing::Test { 147 class UpdateDisplayConfigurationTaskTest : public testing::Test {
148 public: 148 public:
149 UpdateDisplayConfigurationTaskTest() 149 UpdateDisplayConfigurationTaskTest()
150 : delegate_(&log_), 150 : delegate_(&log_),
151 small_mode_(gfx::Size(1366, 768), false, 60.0f), 151 small_mode_(gfx::Size(1366, 768), false, 60.0f),
152 big_mode_(gfx::Size(2560, 1600), false, 60.0f), 152 big_mode_(gfx::Size(2560, 1600), false, 60.0f),
153 configured_(false), 153 configured_(false),
154 configuration_status_(false), 154 configuration_status_(false),
155 display_state_(MULTIPLE_DISPLAY_STATE_INVALID), 155 display_state_(MULTIPLE_DISPLAY_STATE_INVALID),
156 power_state_(chromeos::DISPLAY_POWER_ALL_ON) { 156 power_state_(chromeos::DISPLAY_POWER_ALL_ON) {
157 std::vector<std::unique_ptr<const DisplayMode>> modes; 157 displays_[0] = display::FakeDisplaySnapshot::Builder()
158 modes.push_back(small_mode_.Clone()); 158 .SetId(123)
159 displays_[0].set_current_mode(modes[0].get()); 159 .SetNativeMode(small_mode_.Clone())
160 displays_[0].set_native_mode(modes[0].get()); 160 .SetCurrentMode(small_mode_.Clone())
161 displays_[0].set_modes(std::move(modes)); 161 .Build();
162 displays_[0].set_display_id(123);
163 162
164 modes.clear(); 163 displays_[1] = display::FakeDisplaySnapshot::Builder()
165 modes.push_back(small_mode_.Clone()); 164 .SetId(456)
166 modes.push_back(big_mode_.Clone()); 165 .SetNativeMode(big_mode_.Clone())
167 displays_[1].set_current_mode(modes[1].get()); 166 .SetCurrentMode(big_mode_.Clone())
168 displays_[1].set_native_mode(modes[1].get()); 167 .AddMode(small_mode_.Clone())
169 displays_[1].set_modes(std::move(modes)); 168 .Build();
170 displays_[1].set_display_id(456);
171 } 169 }
172 ~UpdateDisplayConfigurationTaskTest() override {} 170 ~UpdateDisplayConfigurationTaskTest() override {}
173 171
174 void UpdateDisplays(size_t count) { 172 void UpdateDisplays(size_t count) {
175 std::vector<DisplaySnapshot*> displays; 173 std::vector<DisplaySnapshot*> displays;
176 for (size_t i = 0; i < count; ++i) 174 for (size_t i = 0; i < count; ++i)
177 displays.push_back(&displays_[i]); 175 displays.push_back(displays_[i].get());
178 176
179 delegate_.set_outputs(displays); 177 delegate_.set_outputs(displays);
180 } 178 }
181 179
182 void ResponseCallback(bool success, 180 void ResponseCallback(bool success,
183 const std::vector<DisplaySnapshot*>& displays, 181 const std::vector<DisplaySnapshot*>& displays,
184 const gfx::Size& framebuffer_size, 182 const gfx::Size& framebuffer_size,
185 MultipleDisplayState new_display_state, 183 MultipleDisplayState new_display_state,
186 chromeos::DisplayPowerState new_power_state) { 184 chromeos::DisplayPowerState new_power_state) {
187 configured_ = true; 185 configured_ = true;
188 configuration_status_ = success; 186 configuration_status_ = success;
189 display_states_ = displays; 187 display_states_ = displays;
190 display_state_ = new_display_state; 188 display_state_ = new_display_state;
191 power_state_ = new_power_state; 189 power_state_ = new_power_state;
192 190
193 if (success) { 191 if (success) {
194 layout_manager_.set_display_state(display_state_); 192 layout_manager_.set_display_state(display_state_);
195 layout_manager_.set_power_state(power_state_); 193 layout_manager_.set_power_state(power_state_);
196 } 194 }
197 } 195 }
198 196
199 protected: 197 protected:
200 ActionLogger log_; 198 ActionLogger log_;
201 TestNativeDisplayDelegate delegate_; 199 TestNativeDisplayDelegate delegate_;
202 TestDisplayLayoutManager layout_manager_; 200 TestDisplayLayoutManager layout_manager_;
203 201
204 const DisplayMode small_mode_; 202 const DisplayMode small_mode_;
205 const DisplayMode big_mode_; 203 const DisplayMode big_mode_;
206 204
207 TestDisplaySnapshot displays_[2]; 205 std::unique_ptr<DisplaySnapshot> displays_[2];
208 206
209 bool configured_; 207 bool configured_;
210 bool configuration_status_; 208 bool configuration_status_;
211 std::vector<DisplaySnapshot*> display_states_; 209 std::vector<DisplaySnapshot*> display_states_;
212 MultipleDisplayState display_state_; 210 MultipleDisplayState display_state_;
213 chromeos::DisplayPowerState power_state_; 211 chromeos::DisplayPowerState power_state_;
214 212
215 private: 213 private:
216 DISALLOW_COPY_AND_ASSIGN(UpdateDisplayConfigurationTaskTest); 214 DISALLOW_COPY_AND_ASSIGN(UpdateDisplayConfigurationTaskTest);
217 }; 215 };
218 216
219 } // namespace 217 } // namespace
220 218
221 TEST_F(UpdateDisplayConfigurationTaskTest, HeadlessConfiguration) { 219 TEST_F(UpdateDisplayConfigurationTaskTest, HeadlessConfiguration) {
222 { 220 {
223 UpdateDisplayConfigurationTask task( 221 UpdateDisplayConfigurationTask task(
224 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_HEADLESS, 222 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_HEADLESS,
225 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 223 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
226 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 224 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
227 base::Unretained(this))); 225 base::Unretained(this)));
228 task.Run(); 226 task.Run();
229 } 227 }
230 228
231 EXPECT_TRUE(configured_); 229 EXPECT_TRUE(configured_);
232 EXPECT_TRUE(configuration_status_); 230 EXPECT_TRUE(configuration_status_);
233 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_HEADLESS, display_state_); 231 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_HEADLESS, display_state_);
234 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_); 232 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_);
235 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_.GetActionsAndClear()); 233 EXPECT_EQ(JoinActions(kGrab, kUngrab, nullptr), log_.GetActionsAndClear());
236 } 234 }
237 235
238 TEST_F(UpdateDisplayConfigurationTaskTest, SingleConfiguration) { 236 TEST_F(UpdateDisplayConfigurationTaskTest, SingleConfiguration) {
239 UpdateDisplays(1); 237 UpdateDisplays(1);
240 238
241 { 239 {
242 UpdateDisplayConfigurationTask task( 240 UpdateDisplayConfigurationTask task(
243 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_SINGLE, 241 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_SINGLE,
244 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 242 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
245 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 243 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
246 base::Unretained(this))); 244 base::Unretained(this)));
247 task.Run(); 245 task.Run();
248 } 246 }
249 247
250 EXPECT_TRUE(configured_); 248 EXPECT_TRUE(configured_);
251 EXPECT_TRUE(configuration_status_); 249 EXPECT_TRUE(configuration_status_);
252 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, display_state_); 250 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, display_state_);
253 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_); 251 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_);
254 EXPECT_EQ(JoinActions( 252 EXPECT_EQ(
255 kGrab, GetFramebufferAction(small_mode_.size(), &displays_[0], 253 JoinActions(
256 nullptr).c_str(), 254 kGrab,
257 GetCrtcAction(displays_[0], &small_mode_, gfx::Point()).c_str(), 255 GetFramebufferAction(small_mode_.size(), displays_[0].get(), nullptr)
258 kUngrab, NULL), 256 .c_str(),
259 log_.GetActionsAndClear()); 257 GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(),
258 kUngrab, nullptr),
259 log_.GetActionsAndClear());
260 } 260 }
261 261
262 TEST_F(UpdateDisplayConfigurationTaskTest, ExtendedConfiguration) { 262 TEST_F(UpdateDisplayConfigurationTaskTest, ExtendedConfiguration) {
263 UpdateDisplays(2); 263 UpdateDisplays(2);
264 264
265 { 265 {
266 UpdateDisplayConfigurationTask task( 266 UpdateDisplayConfigurationTask task(
267 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 267 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
268 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 268 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
269 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 269 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
270 base::Unretained(this))); 270 base::Unretained(this)));
271 task.Run(); 271 task.Run();
272 } 272 }
273 273
274 EXPECT_TRUE(configured_); 274 EXPECT_TRUE(configured_);
275 EXPECT_TRUE(configuration_status_); 275 EXPECT_TRUE(configuration_status_);
276 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_); 276 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_);
277 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_); 277 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_);
278 EXPECT_EQ( 278 EXPECT_EQ(
279 JoinActions( 279 JoinActions(
280 kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(), 280 kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(),
281 small_mode_.size().height() + 281 small_mode_.size().height() +
282 big_mode_.size().height()), 282 big_mode_.size().height()),
283 &displays_[0], &displays_[1]).c_str(), 283 displays_[0].get(), displays_[1].get())
284 GetCrtcAction(displays_[0], &small_mode_, gfx::Point()).c_str(), 284 .c_str(),
285 GetCrtcAction(displays_[1], &big_mode_, 285 GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(),
286 gfx::Point(0, small_mode_.size().height())).c_str(), 286 GetCrtcAction(*displays_[1], &big_mode_,
287 kUngrab, NULL), 287 gfx::Point(0, small_mode_.size().height()))
288 .c_str(),
289 kUngrab, nullptr),
288 log_.GetActionsAndClear()); 290 log_.GetActionsAndClear());
289 } 291 }
290 292
291 TEST_F(UpdateDisplayConfigurationTaskTest, MirrorConfiguration) { 293 TEST_F(UpdateDisplayConfigurationTaskTest, MirrorConfiguration) {
292 UpdateDisplays(2); 294 UpdateDisplays(2);
293 295
294 { 296 {
295 UpdateDisplayConfigurationTask task( 297 UpdateDisplayConfigurationTask task(
296 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, 298 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR,
297 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 299 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
298 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 300 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
299 base::Unretained(this))); 301 base::Unretained(this)));
300 task.Run(); 302 task.Run();
301 } 303 }
302 304
303 EXPECT_TRUE(configured_); 305 EXPECT_TRUE(configured_);
304 EXPECT_TRUE(configuration_status_); 306 EXPECT_TRUE(configuration_status_);
305 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, display_state_); 307 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, display_state_);
306 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_); 308 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_);
307 EXPECT_EQ(JoinActions( 309 EXPECT_EQ(
308 kGrab, GetFramebufferAction(small_mode_.size(), &displays_[0], 310 JoinActions(
309 &displays_[1]).c_str(), 311 kGrab, GetFramebufferAction(small_mode_.size(), displays_[0].get(),
310 GetCrtcAction(displays_[0], &small_mode_, gfx::Point()).c_str(), 312 displays_[1].get())
311 GetCrtcAction(displays_[1], &small_mode_, gfx::Point()).c_str(), 313 .c_str(),
312 kUngrab, NULL), 314 GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(),
313 log_.GetActionsAndClear()); 315 GetCrtcAction(*displays_[1], &small_mode_, gfx::Point()).c_str(),
316 kUngrab, nullptr),
317 log_.GetActionsAndClear());
314 } 318 }
315 319
316 TEST_F(UpdateDisplayConfigurationTaskTest, FailMirrorConfiguration) { 320 TEST_F(UpdateDisplayConfigurationTaskTest, FailMirrorConfiguration) {
317 layout_manager_.set_should_mirror(false); 321 layout_manager_.set_should_mirror(false);
318 UpdateDisplays(2); 322 UpdateDisplays(2);
319 323
320 { 324 {
321 UpdateDisplayConfigurationTask task( 325 UpdateDisplayConfigurationTask task(
322 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, 326 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR,
323 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 327 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
324 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 328 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
325 base::Unretained(this))); 329 base::Unretained(this)));
326 task.Run(); 330 task.Run();
327 } 331 }
328 332
329 EXPECT_TRUE(configured_); 333 EXPECT_TRUE(configured_);
330 EXPECT_FALSE(configuration_status_); 334 EXPECT_FALSE(configuration_status_);
331 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_.GetActionsAndClear()); 335 EXPECT_EQ(JoinActions(kGrab, kUngrab, nullptr), log_.GetActionsAndClear());
332 } 336 }
333 337
334 TEST_F(UpdateDisplayConfigurationTaskTest, FailExtendedConfiguration) { 338 TEST_F(UpdateDisplayConfigurationTaskTest, FailExtendedConfiguration) {
335 delegate_.set_max_configurable_pixels(1); 339 delegate_.set_max_configurable_pixels(1);
336 UpdateDisplays(2); 340 UpdateDisplays(2);
337 341
338 { 342 {
339 UpdateDisplayConfigurationTask task( 343 UpdateDisplayConfigurationTask task(
340 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 344 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
341 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 345 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
342 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 346 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
343 base::Unretained(this))); 347 base::Unretained(this)));
344 task.Run(); 348 task.Run();
345 } 349 }
346 350
347 EXPECT_TRUE(configured_); 351 EXPECT_TRUE(configured_);
348 EXPECT_FALSE(configuration_status_); 352 EXPECT_FALSE(configuration_status_);
349 EXPECT_EQ( 353 EXPECT_EQ(
350 JoinActions( 354 JoinActions(
351 kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(), 355 kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(),
352 small_mode_.size().height() + 356 small_mode_.size().height() +
353 big_mode_.size().height()), 357 big_mode_.size().height()),
354 &displays_[0], &displays_[1]).c_str(), 358 displays_[0].get(), displays_[1].get())
355 GetCrtcAction(displays_[0], &small_mode_, gfx::Point()).c_str(), 359 .c_str(),
356 GetCrtcAction(displays_[1], &big_mode_, 360 GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(),
357 gfx::Point(0, small_mode_.size().height())).c_str(), 361 GetCrtcAction(*displays_[1], &big_mode_,
358 GetCrtcAction(displays_[1], &small_mode_, 362 gfx::Point(0, small_mode_.size().height()))
359 gfx::Point(0, small_mode_.size().height())).c_str(), 363 .c_str(),
360 kUngrab, NULL), 364 GetCrtcAction(*displays_[1], &small_mode_,
365 gfx::Point(0, small_mode_.size().height()))
366 .c_str(),
367 kUngrab, nullptr),
361 log_.GetActionsAndClear()); 368 log_.GetActionsAndClear());
362 } 369 }
363 370
364 TEST_F(UpdateDisplayConfigurationTaskTest, SingleChangePowerConfiguration) { 371 TEST_F(UpdateDisplayConfigurationTaskTest, SingleChangePowerConfiguration) {
365 UpdateDisplays(1); 372 UpdateDisplays(1);
366 373
367 { 374 {
368 UpdateDisplayConfigurationTask task( 375 UpdateDisplayConfigurationTask task(
369 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_SINGLE, 376 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_SINGLE,
370 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 377 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
371 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 378 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
372 base::Unretained(this))); 379 base::Unretained(this)));
373 task.Run(); 380 task.Run();
374 } 381 }
375 382
376 EXPECT_TRUE(configured_); 383 EXPECT_TRUE(configured_);
377 EXPECT_TRUE(configuration_status_); 384 EXPECT_TRUE(configuration_status_);
378 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, display_state_); 385 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, display_state_);
379 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_); 386 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, power_state_);
380 EXPECT_EQ(JoinActions( 387 EXPECT_EQ(
381 kGrab, GetFramebufferAction(small_mode_.size(), &displays_[0], 388 JoinActions(
382 nullptr).c_str(), 389 kGrab,
383 GetCrtcAction(displays_[0], &small_mode_, gfx::Point()).c_str(), 390 GetFramebufferAction(small_mode_.size(), displays_[0].get(), nullptr)
384 kUngrab, NULL), 391 .c_str(),
385 log_.GetActionsAndClear()); 392 GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(),
393 kUngrab, nullptr),
394 log_.GetActionsAndClear());
386 395
387 // Turn power off 396 // Turn power off
388 { 397 {
389 UpdateDisplayConfigurationTask task( 398 UpdateDisplayConfigurationTask task(
390 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_SINGLE, 399 &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_SINGLE,
391 chromeos::DISPLAY_POWER_ALL_OFF, 0, 0, false, 400 chromeos::DISPLAY_POWER_ALL_OFF, 0, 0, false,
392 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 401 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
393 base::Unretained(this))); 402 base::Unretained(this)));
394 task.Run(); 403 task.Run();
395 } 404 }
396 405
397 EXPECT_TRUE(configuration_status_); 406 EXPECT_TRUE(configuration_status_);
398 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, display_state_); 407 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, display_state_);
399 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_OFF, power_state_); 408 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_OFF, power_state_);
400 EXPECT_EQ( 409 EXPECT_EQ(
401 JoinActions(kGrab, GetFramebufferAction(small_mode_.size(), &displays_[0], 410 JoinActions(kGrab, GetFramebufferAction(small_mode_.size(),
402 nullptr).c_str(), 411 displays_[0].get(), nullptr)
403 GetCrtcAction(displays_[0], nullptr, gfx::Point()).c_str(), 412 .c_str(),
404 kUngrab, NULL), 413 GetCrtcAction(*displays_[0], nullptr, gfx::Point()).c_str(),
414 kUngrab, nullptr),
405 log_.GetActionsAndClear()); 415 log_.GetActionsAndClear());
406 } 416 }
407 417
408 TEST_F(UpdateDisplayConfigurationTaskTest, NoopSoftwareMirrorConfiguration) { 418 TEST_F(UpdateDisplayConfigurationTaskTest, NoopSoftwareMirrorConfiguration) {
409 layout_manager_.set_should_mirror(false); 419 layout_manager_.set_should_mirror(false);
410 layout_manager_.set_software_mirroring_controller( 420 layout_manager_.set_software_mirroring_controller(
411 base::MakeUnique<TestSoftwareMirroringController>()); 421 base::MakeUnique<TestSoftwareMirroringController>());
412 UpdateDisplays(2); 422 UpdateDisplays(2);
413 423
414 { 424 {
(...skipping 13 matching lines...) Expand all
428 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, 438 chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false,
429 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, 439 base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback,
430 base::Unretained(this))); 440 base::Unretained(this)));
431 task.Run(); 441 task.Run();
432 } 442 }
433 443
434 EXPECT_TRUE(configuration_status_); 444 EXPECT_TRUE(configuration_status_);
435 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_); 445 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_);
436 EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController() 446 EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController()
437 ->SoftwareMirroringEnabled()); 447 ->SoftwareMirroringEnabled());
438 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_.GetActionsAndClear()); 448 EXPECT_EQ(JoinActions(kGrab, kUngrab, nullptr), log_.GetActionsAndClear());
439 } 449 }
440 450
441 TEST_F(UpdateDisplayConfigurationTaskTest, 451 TEST_F(UpdateDisplayConfigurationTaskTest,
442 ForceConfigurationWhileGoingToSoftwareMirror) { 452 ForceConfigurationWhileGoingToSoftwareMirror) {
443 layout_manager_.set_should_mirror(false); 453 layout_manager_.set_should_mirror(false);
444 layout_manager_.set_software_mirroring_controller( 454 layout_manager_.set_software_mirroring_controller(
445 base::MakeUnique<TestSoftwareMirroringController>()); 455 base::MakeUnique<TestSoftwareMirroringController>());
446 UpdateDisplays(2); 456 UpdateDisplays(2);
447 457
448 { 458 {
(...skipping 18 matching lines...) Expand all
467 477
468 EXPECT_TRUE(configuration_status_); 478 EXPECT_TRUE(configuration_status_);
469 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_); 479 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_);
470 EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController() 480 EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController()
471 ->SoftwareMirroringEnabled()); 481 ->SoftwareMirroringEnabled());
472 EXPECT_EQ( 482 EXPECT_EQ(
473 JoinActions( 483 JoinActions(
474 kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(), 484 kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(),
475 small_mode_.size().height() + 485 small_mode_.size().height() +
476 big_mode_.size().height()), 486 big_mode_.size().height()),
477 &displays_[0], &displays_[1]).c_str(), 487 displays_[0].get(), displays_[1].get())
478 GetCrtcAction(displays_[0], &small_mode_, gfx::Point()).c_str(), 488 .c_str(),
479 GetCrtcAction(displays_[1], &big_mode_, 489 GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(),
480 gfx::Point(0, small_mode_.size().height())).c_str(), 490 GetCrtcAction(*displays_[1], &big_mode_,
481 kUngrab, NULL), 491 gfx::Point(0, small_mode_.size().height()))
492 .c_str(),
493 kUngrab, nullptr),
482 log_.GetActionsAndClear()); 494 log_.GetActionsAndClear());
483 } 495 }
484 496
485 } // namespace test 497 } // namespace test
486 } // namespace ui 498 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/test/test_display_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698