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

Side by Side Diff: ash/system/chromeos/tray_display_unittest.cc

Issue 1094863006: Put display messages as 'additional' message. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 5 years, 8 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/system/chromeos/tray_display.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/system/chromeos/tray_display.h" 5 #include "ash/system/chromeos/tray_display.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 Shell::GetInstance()->system_tray_delegate()); 416 Shell::GetInstance()->system_tray_delegate());
417 tray_delegate->set_should_show_display_notification(true); 417 tray_delegate->set_should_show_display_notification(true);
418 418
419 UpdateDisplay("400x400"); 419 UpdateDisplay("400x400");
420 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 420 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
421 gfx::Display::SetInternalDisplayId(display_manager->first_display_id()); 421 gfx::Display::SetInternalDisplayId(display_manager->first_display_id());
422 EXPECT_TRUE(GetDisplayNotificationText().empty()); 422 EXPECT_TRUE(GetDisplayNotificationText().empty());
423 423
424 // rotation. 424 // rotation.
425 UpdateDisplay("400x400/r"); 425 UpdateDisplay("400x400/r");
426 EXPECT_EQ( 426 EXPECT_EQ(l10n_util::GetStringFUTF16(
427 l10n_util::GetStringFUTF16( 427 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(),
428 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(), 428 l10n_util::GetStringUTF16(
429 l10n_util::GetStringUTF16( 429 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
430 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)), 430 GetDisplayNotificationAdditionalText());
431 GetDisplayNotificationText()); 431 EXPECT_TRUE(GetDisplayNotificationText().empty());
432 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
433 432
434 CloseNotification(); 433 CloseNotification();
435 UpdateDisplay("400x400"); 434 UpdateDisplay("400x400");
436 EXPECT_EQ( 435 EXPECT_EQ(l10n_util::GetStringFUTF16(
437 l10n_util::GetStringFUTF16( 436 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(),
438 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(), 437 l10n_util::GetStringUTF16(
439 l10n_util::GetStringUTF16( 438 IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION)),
440 IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION)), 439 GetDisplayNotificationAdditionalText());
441 GetDisplayNotificationText()); 440 EXPECT_TRUE(GetDisplayNotificationText().empty());
442 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
443 441
444 // UI-scale 442 // UI-scale
445 CloseNotification(); 443 CloseNotification();
446 UpdateDisplay("400x400@1.5"); 444 UpdateDisplay("400x400@1.5");
447 EXPECT_EQ( 445 EXPECT_EQ(l10n_util::GetStringFUTF16(
448 l10n_util::GetStringFUTF16( 446 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
449 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, 447 GetFirstDisplayName(), base::UTF8ToUTF16("600x600")),
450 GetFirstDisplayName(), base::UTF8ToUTF16("600x600")), 448 GetDisplayNotificationAdditionalText());
451 GetDisplayNotificationText()); 449 EXPECT_TRUE(GetDisplayNotificationText().empty());
452 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
453 450
454 // UI-scale to 1.0 451 // UI-scale to 1.0
455 CloseNotification(); 452 CloseNotification();
456 UpdateDisplay("400x400"); 453 UpdateDisplay("400x400");
457 EXPECT_EQ( 454 EXPECT_EQ(l10n_util::GetStringFUTF16(
458 l10n_util::GetStringFUTF16( 455 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
459 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, 456 GetFirstDisplayName(), base::UTF8ToUTF16("400x400")),
460 GetFirstDisplayName(), base::UTF8ToUTF16("400x400")), 457 GetDisplayNotificationAdditionalText());
461 GetDisplayNotificationText()); 458 EXPECT_TRUE(GetDisplayNotificationText().empty());
462 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
463 459
464 // No-update 460 // No-update
465 CloseNotification(); 461 CloseNotification();
466 UpdateDisplay("400x400"); 462 UpdateDisplay("400x400");
467 EXPECT_TRUE(GetDisplayNotificationText().empty()); 463 EXPECT_TRUE(GetDisplayNotificationText().empty());
468 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); 464 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
469 465
470 // Extended. 466 // Extended.
471 CloseNotification(); 467 CloseNotification();
472 UpdateDisplay("400x400,200x200"); 468 UpdateDisplay("400x400,200x200");
(...skipping 17 matching lines...) Expand all
490 display_manager->SetSoftwareMirroring(false); 486 display_manager->SetSoftwareMirroring(false);
491 UpdateDisplay("400x400,200x200"); 487 UpdateDisplay("400x400,200x200");
492 EXPECT_EQ( 488 EXPECT_EQ(
493 l10n_util::GetStringFUTF16( 489 l10n_util::GetStringFUTF16(
494 IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetSecondDisplayName()), 490 IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetSecondDisplayName()),
495 GetDisplayNotificationText()); 491 GetDisplayNotificationText());
496 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); 492 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
497 493
498 // Resize the first display. 494 // Resize the first display.
499 UpdateDisplay("400x400@1.5,200x200"); 495 UpdateDisplay("400x400@1.5,200x200");
500 EXPECT_EQ( 496 EXPECT_EQ(l10n_util::GetStringFUTF16(
501 l10n_util::GetStringFUTF16( 497 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
502 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, 498 GetFirstDisplayName(), base::UTF8ToUTF16("600x600")),
503 GetFirstDisplayName(), base::UTF8ToUTF16("600x600")), 499 GetDisplayNotificationAdditionalText());
504 GetDisplayNotificationText()); 500 EXPECT_TRUE(GetDisplayNotificationText().empty());
505 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
506 501
507 // Rotate the second. 502 // Rotate the second.
508 UpdateDisplay("400x400@1.5,200x200/r"); 503 UpdateDisplay("400x400@1.5,200x200/r");
509 EXPECT_EQ( 504 EXPECT_EQ(l10n_util::GetStringFUTF16(
510 l10n_util::GetStringFUTF16( 505 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetSecondDisplayName(),
511 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, 506 l10n_util::GetStringUTF16(
512 GetSecondDisplayName(), 507 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
513 l10n_util::GetStringUTF16( 508 GetDisplayNotificationAdditionalText());
514 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)), 509 EXPECT_TRUE(GetDisplayNotificationText().empty());
515 GetDisplayNotificationText());
516 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
517 510
518 // Enters closed lid mode. 511 // Enters closed lid mode.
519 UpdateDisplay("400x400@1.5,200x200"); 512 UpdateDisplay("400x400@1.5,200x200");
520 gfx::Display::SetInternalDisplayId(ScreenUtil::GetSecondaryDisplay().id()); 513 gfx::Display::SetInternalDisplayId(ScreenUtil::GetSecondaryDisplay().id());
521 UpdateDisplay("400x400@1.5"); 514 UpdateDisplay("400x400@1.5");
522 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED), 515 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED),
523 GetDisplayNotificationText()); 516 GetDisplayNotificationText());
524 EXPECT_EQ( 517 EXPECT_EQ(
525 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_DESCRIPTION), 518 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_DESCRIPTION),
526 GetDisplayNotificationAdditionalText()); 519 GetDisplayNotificationAdditionalText());
(...skipping 29 matching lines...) Expand all
556 TEST_F(TrayDisplayTest, UpdateAfterSuppressDisplayNotification) { 549 TEST_F(TrayDisplayTest, UpdateAfterSuppressDisplayNotification) {
557 UpdateDisplay("400x400,200x200"); 550 UpdateDisplay("400x400,200x200");
558 551
559 test::TestSystemTrayDelegate* tray_delegate = 552 test::TestSystemTrayDelegate* tray_delegate =
560 static_cast<test::TestSystemTrayDelegate*>( 553 static_cast<test::TestSystemTrayDelegate*>(
561 Shell::GetInstance()->system_tray_delegate()); 554 Shell::GetInstance()->system_tray_delegate());
562 tray_delegate->set_should_show_display_notification(true); 555 tray_delegate->set_should_show_display_notification(true);
563 556
564 // rotate the second. 557 // rotate the second.
565 UpdateDisplay("400x400,200x200/r"); 558 UpdateDisplay("400x400,200x200/r");
566 EXPECT_EQ( 559 EXPECT_EQ(l10n_util::GetStringFUTF16(
567 l10n_util::GetStringFUTF16( 560 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetSecondDisplayName(),
568 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, 561 l10n_util::GetStringUTF16(
569 GetSecondDisplayName(), 562 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
570 l10n_util::GetStringUTF16( 563 GetDisplayNotificationAdditionalText());
571 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
572 GetDisplayNotificationText());
573 } 564 }
574 565
575 } // namespace ash 566 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/tray_display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698