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

Side by Side Diff: ash/touch/touch_observer_hud_unittest.cc

Issue 2653593004: chromeos: Remove AshTestBase::SupportsMultipleDisplays (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/touch/touch_observer_hud.h" 5 #include "ash/touch/touch_observer_hud.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // Setup a single display setting. 303 // Setup a single display setting.
304 SetupSingleDisplay(); 304 SetupSingleDisplay();
305 305
306 // Check if touch HUD is set correctly and associated with appropriate 306 // Check if touch HUD is set correctly and associated with appropriate
307 // display. 307 // display.
308 CheckInternalDisplay(); 308 CheckInternalDisplay();
309 } 309 }
310 310
311 // Checks if debug touch HUDs are correctly initialized for two displays. 311 // Checks if debug touch HUDs are correctly initialized for two displays.
312 TEST_F(TouchHudDebugTest, DualDisplays) { 312 TEST_F(TouchHudDebugTest, DualDisplays) {
313 if (!SupportsMultipleDisplays())
314 return;
315
316 // Setup a dual display setting. 313 // Setup a dual display setting.
317 SetupDualDisplays(); 314 SetupDualDisplays();
318 315
319 // Check if touch HUDs are set correctly and associated with appropriate 316 // Check if touch HUDs are set correctly and associated with appropriate
320 // displays. 317 // displays.
321 CheckInternalDisplay(); 318 CheckInternalDisplay();
322 CheckExternalDisplay(); 319 CheckExternalDisplay();
323 } 320 }
324 321
325 // Checks if debug touch HUDs are correctly handled when primary display is 322 // Checks if debug touch HUDs are correctly handled when primary display is
326 // changed. 323 // changed.
327 TEST_F(TouchHudDebugTest, SwapPrimaryDisplay) { 324 TEST_F(TouchHudDebugTest, SwapPrimaryDisplay) {
328 if (!SupportsMultipleDisplays())
329 return;
330
331 // Setup a dual display setting. 325 // Setup a dual display setting.
332 SetupDualDisplays(); 326 SetupDualDisplays();
333 327
334 // Set the primary display to the external one. 328 // Set the primary display to the external one.
335 SetExternalAsPrimary(); 329 SetExternalAsPrimary();
336 330
337 // Check if displays' touch HUDs are not swapped as root windows are. 331 // Check if displays' touch HUDs are not swapped as root windows are.
338 EXPECT_EQ(external_display_id(), GetPrimaryDisplay().id()); 332 EXPECT_EQ(external_display_id(), GetPrimaryDisplay().id());
339 EXPECT_EQ(internal_display_id(), 333 EXPECT_EQ(internal_display_id(),
340 display_manager()->GetSecondaryDisplay().id()); 334 display_manager()->GetSecondaryDisplay().id());
341 CheckInternalDisplay(); 335 CheckInternalDisplay();
342 CheckExternalDisplay(); 336 CheckExternalDisplay();
343 337
344 // Set the primary display back to the internal one. 338 // Set the primary display back to the internal one.
345 SetInternalAsPrimary(); 339 SetInternalAsPrimary();
346 340
347 // Check if displays' touch HUDs are not swapped back as root windows are. 341 // Check if displays' touch HUDs are not swapped back as root windows are.
348 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 342 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
349 EXPECT_EQ(external_display_id(), 343 EXPECT_EQ(external_display_id(),
350 display_manager()->GetSecondaryDisplay().id()); 344 display_manager()->GetSecondaryDisplay().id());
351 CheckInternalDisplay(); 345 CheckInternalDisplay();
352 CheckExternalDisplay(); 346 CheckExternalDisplay();
353 } 347 }
354 348
355 // Checks if debug touch HUDs are correctly handled when displays are mirrored. 349 // Checks if debug touch HUDs are correctly handled when displays are mirrored.
356 TEST_F(TouchHudDebugTest, MirrorDisplays) { 350 TEST_F(TouchHudDebugTest, MirrorDisplays) {
357 if (!SupportsMultipleDisplays())
358 return;
359
360 // Setup a dual display setting. 351 // Setup a dual display setting.
361 SetupDualDisplays(); 352 SetupDualDisplays();
362 353
363 // Mirror displays. 354 // Mirror displays.
364 MirrorDisplays(); 355 MirrorDisplays();
365 356
366 // Check if the internal display is intact. 357 // Check if the internal display is intact.
367 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 358 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
368 CheckInternalDisplay(); 359 CheckInternalDisplay();
369 360
370 // Unmirror displays. 361 // Unmirror displays.
371 UnmirrorDisplays(); 362 UnmirrorDisplays();
372 363
373 // Check if external display is added back correctly. 364 // Check if external display is added back correctly.
374 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 365 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
375 EXPECT_EQ(external_display_id(), 366 EXPECT_EQ(external_display_id(),
376 display_manager()->GetSecondaryDisplay().id()); 367 display_manager()->GetSecondaryDisplay().id());
377 CheckInternalDisplay(); 368 CheckInternalDisplay();
378 CheckExternalDisplay(); 369 CheckExternalDisplay();
379 } 370 }
380 371
381 // Checks if debug touch HUDs are correctly handled when displays are mirrored 372 // Checks if debug touch HUDs are correctly handled when displays are mirrored
382 // after setting the external display as the primary one. 373 // after setting the external display as the primary one.
383 TEST_F(TouchHudDebugTest, SwapPrimaryThenMirrorDisplays) { 374 TEST_F(TouchHudDebugTest, SwapPrimaryThenMirrorDisplays) {
384 if (!SupportsMultipleDisplays())
385 return;
386
387 // Setup a dual display setting. 375 // Setup a dual display setting.
388 SetupDualDisplays(); 376 SetupDualDisplays();
389 377
390 // Set the primary display to the external one. 378 // Set the primary display to the external one.
391 SetExternalAsPrimary(); 379 SetExternalAsPrimary();
392 380
393 // Mirror displays. 381 // Mirror displays.
394 MirrorDisplays(); 382 MirrorDisplays();
395 383
396 // Check if the internal display is set as the primary one. 384 // Check if the internal display is set as the primary one.
397 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 385 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
398 CheckInternalDisplay(); 386 CheckInternalDisplay();
399 387
400 // Unmirror displays. 388 // Unmirror displays.
401 UnmirrorDisplays(); 389 UnmirrorDisplays();
402 390
403 // Check if the external display is added back as the primary display and 391 // Check if the external display is added back as the primary display and
404 // touch HUDs are set correctly. 392 // touch HUDs are set correctly.
405 EXPECT_EQ(external_display_id(), GetPrimaryDisplay().id()); 393 EXPECT_EQ(external_display_id(), GetPrimaryDisplay().id());
406 EXPECT_EQ(internal_display_id(), 394 EXPECT_EQ(internal_display_id(),
407 display_manager()->GetSecondaryDisplay().id()); 395 display_manager()->GetSecondaryDisplay().id());
408 CheckInternalDisplay(); 396 CheckInternalDisplay();
409 CheckExternalDisplay(); 397 CheckExternalDisplay();
410 } 398 }
411 399
412 // Checks if debug touch HUDs are correctly handled when the external display, 400 // Checks if debug touch HUDs are correctly handled when the external display,
413 // which is the secondary one, is removed. 401 // which is the secondary one, is removed.
414 TEST_F(TouchHudDebugTest, RemoveSecondaryDisplay) { 402 TEST_F(TouchHudDebugTest, RemoveSecondaryDisplay) {
415 if (!SupportsMultipleDisplays())
416 return;
417
418 // Setup a dual display setting. 403 // Setup a dual display setting.
419 SetupDualDisplays(); 404 SetupDualDisplays();
420 405
421 // Remove external display which is the secondary one. 406 // Remove external display which is the secondary one.
422 RemoveExternalDisplay(); 407 RemoveExternalDisplay();
423 408
424 // Check if the internal display is intact. 409 // Check if the internal display is intact.
425 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 410 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
426 CheckInternalDisplay(); 411 CheckInternalDisplay();
427 412
428 // Add external display back. 413 // Add external display back.
429 AddExternalDisplay(); 414 AddExternalDisplay();
430 415
431 // Check if displays' touch HUDs are set correctly. 416 // Check if displays' touch HUDs are set correctly.
432 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 417 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
433 EXPECT_EQ(external_display_id(), 418 EXPECT_EQ(external_display_id(),
434 display_manager()->GetSecondaryDisplay().id()); 419 display_manager()->GetSecondaryDisplay().id());
435 CheckInternalDisplay(); 420 CheckInternalDisplay();
436 CheckExternalDisplay(); 421 CheckExternalDisplay();
437 } 422 }
438 423
439 // Checks if debug touch HUDs are correctly handled when the external display, 424 // Checks if debug touch HUDs are correctly handled when the external display,
440 // which is set as the primary display, is removed. 425 // which is set as the primary display, is removed.
441 TEST_F(TouchHudDebugTest, RemovePrimaryDisplay) { 426 TEST_F(TouchHudDebugTest, RemovePrimaryDisplay) {
442 if (!SupportsMultipleDisplays())
443 return;
444
445 // Setup a dual display setting. 427 // Setup a dual display setting.
446 SetupDualDisplays(); 428 SetupDualDisplays();
447 429
448 // Set the primary display to the external one. 430 // Set the primary display to the external one.
449 SetExternalAsPrimary(); 431 SetExternalAsPrimary();
450 432
451 // Remove the external display which is the primary display. 433 // Remove the external display which is the primary display.
452 RemoveExternalDisplay(); 434 RemoveExternalDisplay();
453 435
454 // Check if the internal display is set as the primary one. 436 // Check if the internal display is set as the primary one.
455 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 437 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
456 CheckInternalDisplay(); 438 CheckInternalDisplay();
457 439
458 // Add the external display back. 440 // Add the external display back.
459 AddExternalDisplay(); 441 AddExternalDisplay();
460 442
461 // Check if the external display is set as primary and touch HUDs are set 443 // Check if the external display is set as primary and touch HUDs are set
462 // correctly. 444 // correctly.
463 EXPECT_EQ(external_display_id(), GetPrimaryDisplay().id()); 445 EXPECT_EQ(external_display_id(), GetPrimaryDisplay().id());
464 EXPECT_EQ(internal_display_id(), 446 EXPECT_EQ(internal_display_id(),
465 display_manager()->GetSecondaryDisplay().id()); 447 display_manager()->GetSecondaryDisplay().id());
466 CheckInternalDisplay(); 448 CheckInternalDisplay();
467 CheckExternalDisplay(); 449 CheckExternalDisplay();
468 } 450 }
469 451
470 // Checks if debug touch HUDs are correctly handled when all displays are 452 // Checks if debug touch HUDs are correctly handled when all displays are
471 // removed. 453 // removed.
472 TEST_F(TouchHudDebugTest, Headless) { 454 TEST_F(TouchHudDebugTest, Headless) {
473 if (!SupportsMultipleDisplays())
474 return;
475
476 // Setup a single display setting. 455 // Setup a single display setting.
477 SetupSingleDisplay(); 456 SetupSingleDisplay();
478 457
479 // Remove the only display which is the internal one. 458 // Remove the only display which is the internal one.
480 RemoveInternalDisplay(); 459 RemoveInternalDisplay();
481 460
482 // Add the internal display back. 461 // Add the internal display back.
483 AddInternalDisplay(); 462 AddInternalDisplay();
484 463
485 // Check if the display's touch HUD is set correctly. 464 // Check if the display's touch HUD is set correctly.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 563
585 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); 564 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1);
586 EXPECT_EQ(1, GetInternalTouchPointsCount()); 565 EXPECT_EQ(1, GetInternalTouchPointsCount());
587 566
588 // Disabling projection touch HUD shoud remove it without crashing. 567 // Disabling projection touch HUD shoud remove it without crashing.
589 DisableTouchHudProjection(); 568 DisableTouchHudProjection();
590 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 569 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
591 } 570 }
592 571
593 } // namespace ash 572 } // namespace ash
OLDNEW
« no previous file with comments | « ash/tooltips/tooltip_controller_unittest.cc ('k') | ash/utility/screenshot_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698