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