OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/scoped_target_root_window.h" | 5 #include "ash/scoped_target_root_window.h" |
6 #include "ash/screen_util.h" | 6 #include "ash/screen_util.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/test/test_shell_delegate.h" | 9 #include "ash/test/test_shell_delegate.h" |
10 #include "ash/wm/window_positioner.h" | 10 #include "ash/wm/window_positioner.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 #else | 422 #else |
423 #define MAYBE_PlaceNewWindows PlaceNewWindows | 423 #define MAYBE_PlaceNewWindows PlaceNewWindows |
424 #endif | 424 #endif |
425 | 425 |
426 // Test the placement of newly created windows. | 426 // Test the placement of newly created windows. |
427 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindows) { | 427 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindows) { |
428 // Create a browser to pass into the GetWindowBounds function. | 428 // Create a browser to pass into the GetWindowBounds function. |
429 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 429 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
430 // Creating a popup handler here to make sure it does not interfere with the | 430 // Creating a popup handler here to make sure it does not interfere with the |
431 // existing windows. | 431 // existing windows. |
432 Browser::CreateParams native_params(profile.get(), | 432 Browser::CreateParams native_params(profile.get()); |
433 chrome::HOST_DESKTOP_TYPE_ASH); | |
434 scoped_ptr<Browser> browser( | 433 scoped_ptr<Browser> browser( |
435 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 434 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
436 | 435 |
437 // Creating a popup handler here to make sure it does not interfere with the | 436 // Creating a popup handler here to make sure it does not interfere with the |
438 // existing windows. | 437 // existing windows. |
439 Browser::CreateParams params2(profile.get(), chrome::HOST_DESKTOP_TYPE_ASH); | 438 Browser::CreateParams params2(profile.get()); |
440 scoped_ptr<Browser> browser2(CreateTestBrowser( | 439 scoped_ptr<Browser> browser2(CreateTestBrowser( |
441 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms2)); | 440 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms2)); |
442 BrowserWindow* browser_window = browser2->window(); | 441 BrowserWindow* browser_window = browser2->window(); |
443 | 442 |
444 // Creating a popup to make sure it does not interfere with the positioning. | 443 // Creating a popup to make sure it does not interfere with the positioning. |
445 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get(), | 444 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get()); |
446 chrome::HOST_DESKTOP_TYPE_ASH); | |
447 scoped_ptr<Browser> browser_popup( | 445 scoped_ptr<Browser> browser_popup( |
448 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 446 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
449 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); | 447 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); |
450 | 448 |
451 // Creating a panel to make sure it does not interfere with the positioning. | 449 // Creating a panel to make sure it does not interfere with the positioning. |
452 Browser::CreateParams params_panel(Browser::TYPE_POPUP, profile.get(), | 450 Browser::CreateParams params_panel(Browser::TYPE_POPUP, profile.get()); |
453 chrome::HOST_DESKTOP_TYPE_ASH); | |
454 scoped_ptr<Browser> browser_panel( | 451 scoped_ptr<Browser> browser_panel( |
455 CreateTestBrowser(CreateTestWindowInShellWithId(2), | 452 CreateTestBrowser(CreateTestWindowInShellWithId(2), |
456 gfx::Rect(32, 48, 256, 512), ¶ms_panel)); | 453 gfx::Rect(32, 48, 256, 512), ¶ms_panel)); |
457 | 454 |
458 browser_window->Show(); | 455 browser_window->Show(); |
459 { // Make sure that popups do not get changed. | 456 { // Make sure that popups do not get changed. |
460 gfx::Rect window_bounds; | 457 gfx::Rect window_bounds; |
461 GetWindowBounds(p1600x1200, p1600x1200, gfx::Rect(), | 458 GetWindowBounds(p1600x1200, p1600x1200, gfx::Rect(), |
462 gfx::Rect(50, 100, 300, 150), bottom_s1600x1200, PERSISTED, | 459 gfx::Rect(50, 100, 300, 150), bottom_s1600x1200, PERSISTED, |
463 browser_popup.get(), gfx::Rect(), &window_bounds); | 460 browser_popup.get(), gfx::Rect(), &window_bounds); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 #else | 496 #else |
500 #define MAYBE_PlaceNewBrowserWindowOnEmptyDesktop PlaceNewBrowserWindowOnEmptyDe
sktop | 497 #define MAYBE_PlaceNewBrowserWindowOnEmptyDesktop PlaceNewBrowserWindowOnEmptyDe
sktop |
501 #endif | 498 #endif |
502 | 499 |
503 // Test the placement of newly created windows on an empty desktop. | 500 // Test the placement of newly created windows on an empty desktop. |
504 // This test supplements "PlaceNewWindows" by testing the creation of a newly | 501 // This test supplements "PlaceNewWindows" by testing the creation of a newly |
505 // created browser window on an empty desktop. | 502 // created browser window on an empty desktop. |
506 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewBrowserWindowOnEmptyDesktop) { | 503 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewBrowserWindowOnEmptyDesktop) { |
507 // Create a browser to pass into the GetWindowBoundsAndShowState function. | 504 // Create a browser to pass into the GetWindowBoundsAndShowState function. |
508 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 505 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
509 Browser::CreateParams native_params(profile.get(), | 506 Browser::CreateParams native_params(profile.get()); |
510 chrome::HOST_DESKTOP_TYPE_ASH); | |
511 scoped_ptr<Browser> browser( | 507 scoped_ptr<Browser> browser( |
512 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 508 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
513 | 509 |
514 // A common screen size for Chrome OS devices where this behavior is | 510 // A common screen size for Chrome OS devices where this behavior is |
515 // desirable. | 511 // desirable. |
516 const gfx::Rect p1366x768(0, 0, 1366, 768); | 512 const gfx::Rect p1366x768(0, 0, 1366, 768); |
517 | 513 |
518 // If there is no previous state the window should get maximized if the | 514 // If there is no previous state the window should get maximized if the |
519 // screen is less than or equal to our limit (1366 pixels width). | 515 // screen is less than or equal to our limit (1366 pixels width). |
520 gfx::Rect window_bounds; | 516 gfx::Rect window_bounds; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 gfx::Rect primary_bounds = | 583 gfx::Rect primary_bounds = |
588 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 584 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
589 gfx::Rect secondary_bounds = ash::ScreenUtil::GetSecondaryDisplay().bounds(); | 585 gfx::Rect secondary_bounds = ash::ScreenUtil::GetSecondaryDisplay().bounds(); |
590 | 586 |
591 ash::Shell::GetInstance()->set_target_root_window( | 587 ash::Shell::GetInstance()->set_target_root_window( |
592 ash::Shell::GetPrimaryRootWindow()); | 588 ash::Shell::GetPrimaryRootWindow()); |
593 | 589 |
594 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 590 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
595 | 591 |
596 // Create browser windows that are used as reference. | 592 // Create browser windows that are used as reference. |
597 Browser::CreateParams params(profile.get(), chrome::HOST_DESKTOP_TYPE_ASH); | 593 Browser::CreateParams params(profile.get()); |
598 scoped_ptr<Browser> browser(CreateTestBrowser( | 594 scoped_ptr<Browser> browser(CreateTestBrowser( |
599 CreateTestWindowInShellWithId(0), gfx::Rect(10, 10, 200, 200), ¶ms)); | 595 CreateTestWindowInShellWithId(0), gfx::Rect(10, 10, 200, 200), ¶ms)); |
600 BrowserWindow* browser_window = browser->window(); | 596 BrowserWindow* browser_window = browser->window(); |
601 gfx::NativeWindow native_window = browser_window->GetNativeWindow(); | 597 gfx::NativeWindow native_window = browser_window->GetNativeWindow(); |
602 browser_window->Show(); | 598 browser_window->Show(); |
603 EXPECT_EQ(native_window->GetRootWindow(), ash::Shell::GetTargetRootWindow()); | 599 EXPECT_EQ(native_window->GetRootWindow(), ash::Shell::GetTargetRootWindow()); |
604 | 600 |
605 Browser::CreateParams another_params(profile.get(), | 601 Browser::CreateParams another_params(profile.get()); |
606 chrome::HOST_DESKTOP_TYPE_ASH); | |
607 scoped_ptr<Browser> another_browser( | 602 scoped_ptr<Browser> another_browser( |
608 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 603 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
609 gfx::Rect(400, 10, 300, 300), &another_params)); | 604 gfx::Rect(400, 10, 300, 300), &another_params)); |
610 BrowserWindow* another_browser_window = another_browser->window(); | 605 BrowserWindow* another_browser_window = another_browser->window(); |
611 gfx::NativeWindow another_native_window = | 606 gfx::NativeWindow another_native_window = |
612 another_browser_window->GetNativeWindow(); | 607 another_browser_window->GetNativeWindow(); |
613 another_browser_window->Show(); | 608 another_browser_window->Show(); |
614 | 609 |
615 // Creating a new window to verify the new placement. | 610 // Creating a new window to verify the new placement. |
616 Browser::CreateParams new_params(profile.get(), | 611 Browser::CreateParams new_params(profile.get()); |
617 chrome::HOST_DESKTOP_TYPE_ASH); | |
618 scoped_ptr<Browser> new_browser(CreateTestBrowser( | 612 scoped_ptr<Browser> new_browser(CreateTestBrowser( |
619 CreateTestWindowInShellWithId(0), gfx::Rect(), &new_params)); | 613 CreateTestWindowInShellWithId(0), gfx::Rect(), &new_params)); |
620 | 614 |
621 // Make sure the primary root is active. | 615 // Make sure the primary root is active. |
622 ASSERT_EQ(ash::Shell::GetPrimaryRootWindow(), | 616 ASSERT_EQ(ash::Shell::GetPrimaryRootWindow(), |
623 ash::Shell::GetTargetRootWindow()); | 617 ash::Shell::GetTargetRootWindow()); |
624 | 618 |
625 // First new window should be in the primary. | 619 // First new window should be in the primary. |
626 { | 620 { |
627 gfx::Rect window_bounds; | 621 gfx::Rect window_bounds; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 #define MAYBE_TestShowState DISABLED_TestShowState | 676 #define MAYBE_TestShowState DISABLED_TestShowState |
683 #else | 677 #else |
684 #define MAYBE_TestShowState TestShowState | 678 #define MAYBE_TestShowState TestShowState |
685 #endif | 679 #endif |
686 | 680 |
687 // Test that the show state is properly returned for non default cases. | 681 // Test that the show state is properly returned for non default cases. |
688 TEST_F(WindowSizerAshTest, MAYBE_TestShowState) { | 682 TEST_F(WindowSizerAshTest, MAYBE_TestShowState) { |
689 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 683 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
690 | 684 |
691 // Creating a browser & window to play with. | 685 // Creating a browser & window to play with. |
692 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get(), | 686 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get()); |
693 chrome::HOST_DESKTOP_TYPE_ASH); | |
694 scoped_ptr<Browser> browser(CreateTestBrowser( | 687 scoped_ptr<Browser> browser(CreateTestBrowser( |
695 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); | 688 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); |
696 | 689 |
697 // Create also a popup browser since that behaves different. | 690 // Create also a popup browser since that behaves different. |
698 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get(), | 691 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get()); |
699 chrome::HOST_DESKTOP_TYPE_ASH); | |
700 scoped_ptr<Browser> browser_popup( | 692 scoped_ptr<Browser> browser_popup( |
701 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 693 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
702 gfx::Rect(16, 32, 640, 320), ¶ms_popup)); | 694 gfx::Rect(16, 32, 640, 320), ¶ms_popup)); |
703 | 695 |
704 // Tabbed windows should retrieve the saved window state - since there is a | 696 // Tabbed windows should retrieve the saved window state - since there is a |
705 // top window. | 697 // top window. |
706 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, | 698 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, |
707 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_NORMAL, | 699 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_NORMAL, |
708 BOTH, browser.get(), p1600x1200, p1600x1200)); | 700 BOTH, browser.get(), p1600x1200, p1600x1200)); |
709 // A window that is smaller than the whole work area is set to default state. | 701 // A window that is smaller than the whole work area is set to default state. |
(...skipping 11 matching lines...) Expand all Loading... |
721 browser_popup.get(), p1600x1200, p1600x1200)); | 713 browser_popup.get(), p1600x1200, p1600x1200)); |
722 // The non tabbed window will take the status of the last active of its kind. | 714 // The non tabbed window will take the status of the last active of its kind. |
723 EXPECT_EQ( | 715 EXPECT_EQ( |
724 ui::SHOW_STATE_NORMAL, | 716 ui::SHOW_STATE_NORMAL, |
725 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 717 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
726 browser_popup.get(), p1600x1200, p1600x1200)); | 718 browser_popup.get(), p1600x1200, p1600x1200)); |
727 | 719 |
728 // Now create a top level window and check again for both. Only the tabbed | 720 // Now create a top level window and check again for both. Only the tabbed |
729 // window should follow the top level window's state. | 721 // window should follow the top level window's state. |
730 // Creating a browser & window to play with. | 722 // Creating a browser & window to play with. |
731 Browser::CreateParams params2(Browser::TYPE_TABBED, profile.get(), | 723 Browser::CreateParams params2(Browser::TYPE_TABBED, profile.get()); |
732 chrome::HOST_DESKTOP_TYPE_ASH); | |
733 scoped_ptr<Browser> browser2(CreateTestBrowser( | 724 scoped_ptr<Browser> browser2(CreateTestBrowser( |
734 CreateTestWindowInShellWithId(3), gfx::Rect(16, 32, 640, 320), ¶ms2)); | 725 CreateTestWindowInShellWithId(3), gfx::Rect(16, 32, 640, 320), ¶ms2)); |
735 | 726 |
736 // A tabbed window should now take the top level window state. | 727 // A tabbed window should now take the top level window state. |
737 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, | 728 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, |
738 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, | 729 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, |
739 BOTH, browser.get(), p1600x1200, p1600x1200)); | 730 BOTH, browser.get(), p1600x1200, p1600x1200)); |
740 // Non tabbed windows should always follow the window saved visibility state. | 731 // Non tabbed windows should always follow the window saved visibility state. |
741 EXPECT_EQ( | 732 EXPECT_EQ( |
742 ui::SHOW_STATE_MAXIMIZED, | 733 ui::SHOW_STATE_MAXIMIZED, |
(...skipping 15 matching lines...) Expand all Loading... |
758 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, | 749 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, |
759 BOTH, browser2.get(), tiny_screen, tiny_screen)); | 750 BOTH, browser2.get(), tiny_screen, tiny_screen)); |
760 } | 751 } |
761 } | 752 } |
762 | 753 |
763 // Test that the default show state override behavior is properly handled. | 754 // Test that the default show state override behavior is properly handled. |
764 TEST_F(WindowSizerAshTest, TestShowStateDefaults) { | 755 TEST_F(WindowSizerAshTest, TestShowStateDefaults) { |
765 // Creating a browser & window to play with. | 756 // Creating a browser & window to play with. |
766 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 757 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
767 | 758 |
768 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get(), | 759 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get()); |
769 chrome::HOST_DESKTOP_TYPE_ASH); | |
770 scoped_ptr<Browser> browser(CreateTestBrowser( | 760 scoped_ptr<Browser> browser(CreateTestBrowser( |
771 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); | 761 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); |
772 | 762 |
773 // Create also a popup browser since that behaves slightly different for | 763 // Create also a popup browser since that behaves slightly different for |
774 // defaults. | 764 // defaults. |
775 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get(), | 765 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get()); |
776 chrome::HOST_DESKTOP_TYPE_ASH); | |
777 scoped_ptr<Browser> browser_popup( | 766 scoped_ptr<Browser> browser_popup( |
778 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 767 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
779 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); | 768 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); |
780 | 769 |
781 // Check that a browser creation state always get used if not given as | 770 // Check that a browser creation state always get used if not given as |
782 // SHOW_STATE_DEFAULT. On Windows ASH it should be SHOW_STATE_MAXIMIZED. | 771 // SHOW_STATE_DEFAULT. On Windows ASH it should be SHOW_STATE_MAXIMIZED. |
783 ui::WindowShowState window_show_state = | 772 ui::WindowShowState window_show_state = |
784 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_MAXIMIZED, | 773 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_MAXIMIZED, |
785 DEFAULT, browser.get(), p1600x1200, p1600x1200); | 774 DEFAULT, browser.get(), p1600x1200, p1600x1200); |
786 #if defined(OS_WIN) | 775 #if defined(OS_WIN) |
(...skipping 30 matching lines...) Expand all Loading... |
817 // The popup should favor the initial show state over the command line. | 806 // The popup should favor the initial show state over the command line. |
818 EXPECT_EQ( | 807 EXPECT_EQ( |
819 GetWindowShowState(ui::SHOW_STATE_NORMAL, ui::SHOW_STATE_NORMAL, BOTH, | 808 GetWindowShowState(ui::SHOW_STATE_NORMAL, ui::SHOW_STATE_NORMAL, BOTH, |
820 browser_popup.get(), p1600x1200, p1600x1200), | 809 browser_popup.get(), p1600x1200, p1600x1200), |
821 ui::SHOW_STATE_NORMAL); | 810 ui::SHOW_STATE_NORMAL); |
822 } | 811 } |
823 | 812 |
824 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { | 813 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { |
825 // Create a browser to pass into the GetWindowBounds function. | 814 // Create a browser to pass into the GetWindowBounds function. |
826 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 815 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
827 Browser::CreateParams native_params(profile.get(), | 816 Browser::CreateParams native_params(profile.get()); |
828 chrome::HOST_DESKTOP_TYPE_ASH); | |
829 scoped_ptr<Browser> browser( | 817 scoped_ptr<Browser> browser( |
830 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 818 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
831 | 819 |
832 gfx::Rect display_bounds = | 820 gfx::Rect display_bounds = |
833 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 821 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
834 gfx::Rect specified_bounds = display_bounds; | 822 gfx::Rect specified_bounds = display_bounds; |
835 | 823 |
836 // Make a window bigger than the display work area. | 824 // Make a window bigger than the display work area. |
837 specified_bounds.Inset(-20, -20); | 825 specified_bounds.Inset(-20, -20); |
838 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; | 826 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 gfx::Rect(), | 875 gfx::Rect(), |
888 NULL, | 876 NULL, |
889 &bounds, | 877 &bounds, |
890 &show_state); | 878 &show_state); |
891 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); | 879 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); |
892 } | 880 } |
893 } | 881 } |
894 | 882 |
895 TEST_F(WindowSizerAshTest, TrustedPopupBehavior) { | 883 TEST_F(WindowSizerAshTest, TrustedPopupBehavior) { |
896 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 884 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
897 Browser::CreateParams trusted_popup_create_params( | 885 Browser::CreateParams trusted_popup_create_params(Browser::TYPE_POPUP, |
898 Browser::TYPE_POPUP, profile.get(), chrome::HOST_DESKTOP_TYPE_ASH); | 886 profile.get()); |
899 trusted_popup_create_params.trusted_source = true; | 887 trusted_popup_create_params.trusted_source = true; |
900 | 888 |
901 scoped_ptr<Browser> trusted_popup(CreateTestBrowser( | 889 scoped_ptr<Browser> trusted_popup(CreateTestBrowser( |
902 CreateTestWindowInShellWithId(1), gfx::Rect(16, 32, 640, 320), | 890 CreateTestWindowInShellWithId(1), gfx::Rect(16, 32, 640, 320), |
903 &trusted_popup_create_params)); | 891 &trusted_popup_create_params)); |
904 // Trusted popup windows should follow the saved show state and ignore the | 892 // Trusted popup windows should follow the saved show state and ignore the |
905 // last show state. | 893 // last show state. |
906 EXPECT_EQ( | 894 EXPECT_EQ( |
907 ui::SHOW_STATE_DEFAULT, | 895 ui::SHOW_STATE_DEFAULT, |
908 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 896 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
909 trusted_popup.get(), p1280x1024, p1600x1200)); | 897 trusted_popup.get(), p1280x1024, p1600x1200)); |
910 // A popup that is sized to occupy the whole work area has default state. | 898 // A popup that is sized to occupy the whole work area has default state. |
911 EXPECT_EQ( | 899 EXPECT_EQ( |
912 ui::SHOW_STATE_DEFAULT, | 900 ui::SHOW_STATE_DEFAULT, |
913 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 901 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
914 trusted_popup.get(), p1600x1200, p1600x1200)); | 902 trusted_popup.get(), p1600x1200, p1600x1200)); |
915 } | 903 } |
OLD | NEW |