| 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/common/scoped_root_window_for_new_windows.h" | 5 #include "ash/common/scoped_root_window_for_new_windows.h" |
| 6 #include "ash/common/wm/window_positioner.h" | 6 #include "ash/common/wm/window_positioner.h" |
| 7 #include "ash/common/wm/window_resizer.h" | 7 #include "ash/common/wm/window_resizer.h" |
| 8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 window_bounds.ToString()); | 409 window_bounds.ToString()); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 // Test the placement of newly created windows. | 413 // Test the placement of newly created windows. |
| 414 TEST_F(WindowSizerAshTest, PlaceNewWindows) { | 414 TEST_F(WindowSizerAshTest, PlaceNewWindows) { |
| 415 // Create a browser to pass into the GetWindowBounds function. | 415 // Create a browser to pass into the GetWindowBounds function. |
| 416 std::unique_ptr<TestingProfile> profile(new TestingProfile()); | 416 std::unique_ptr<TestingProfile> profile(new TestingProfile()); |
| 417 // Creating a popup handler here to make sure it does not interfere with the | 417 // Creating a popup handler here to make sure it does not interfere with the |
| 418 // existing windows. | 418 // existing windows. |
| 419 Browser::CreateParams native_params(profile.get()); | 419 Browser::CreateParams native_params(profile.get(), true); |
| 420 std::unique_ptr<Browser> browser( | 420 std::unique_ptr<Browser> browser( |
| 421 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 421 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
| 422 | 422 |
| 423 // Creating a popup handler here to make sure it does not interfere with the | 423 // Creating a popup handler here to make sure it does not interfere with the |
| 424 // existing windows. | 424 // existing windows. |
| 425 Browser::CreateParams params2(profile.get()); | 425 Browser::CreateParams params2(profile.get(), true); |
| 426 std::unique_ptr<Browser> browser2(CreateTestBrowser( | 426 std::unique_ptr<Browser> browser2(CreateTestBrowser( |
| 427 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms2)); | 427 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms2)); |
| 428 BrowserWindow* browser_window = browser2->window(); | 428 BrowserWindow* browser_window = browser2->window(); |
| 429 | 429 |
| 430 // Creating a popup to make sure it does not interfere with the positioning. | 430 // Creating a popup to make sure it does not interfere with the positioning. |
| 431 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get()); | 431 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get(), true); |
| 432 std::unique_ptr<Browser> browser_popup( | 432 std::unique_ptr<Browser> browser_popup( |
| 433 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 433 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
| 434 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); | 434 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); |
| 435 | 435 |
| 436 // Creating a panel to make sure it does not interfere with the positioning. | 436 // Creating a panel to make sure it does not interfere with the positioning. |
| 437 Browser::CreateParams params_panel(Browser::TYPE_POPUP, profile.get()); | 437 Browser::CreateParams params_panel(Browser::TYPE_POPUP, profile.get(), true); |
| 438 std::unique_ptr<Browser> browser_panel( | 438 std::unique_ptr<Browser> browser_panel( |
| 439 CreateTestBrowser(CreateTestWindowInShellWithId(2), | 439 CreateTestBrowser(CreateTestWindowInShellWithId(2), |
| 440 gfx::Rect(32, 48, 256, 512), ¶ms_panel)); | 440 gfx::Rect(32, 48, 256, 512), ¶ms_panel)); |
| 441 | 441 |
| 442 browser_window->Show(); | 442 browser_window->Show(); |
| 443 { // Make sure that popups do not get changed. | 443 { // Make sure that popups do not get changed. |
| 444 gfx::Rect window_bounds; | 444 gfx::Rect window_bounds; |
| 445 GetWindowBounds(p1600x1200, p1600x1200, gfx::Rect(), | 445 GetWindowBounds(p1600x1200, p1600x1200, gfx::Rect(), |
| 446 gfx::Rect(50, 100, 300, 150), bottom_s1600x1200, PERSISTED, | 446 gfx::Rect(50, 100, 300, 150), bottom_s1600x1200, PERSISTED, |
| 447 browser_popup.get(), gfx::Rect(), &window_bounds); | 447 browser_popup.get(), gfx::Rect(), &window_bounds); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 475 window_bounds.ToString()); | 475 window_bounds.ToString()); |
| 476 } | 476 } |
| 477 } | 477 } |
| 478 | 478 |
| 479 // Test the placement of newly created windows on an empty desktop. | 479 // Test the placement of newly created windows on an empty desktop. |
| 480 // This test supplements "PlaceNewWindows" by testing the creation of a newly | 480 // This test supplements "PlaceNewWindows" by testing the creation of a newly |
| 481 // created browser window on an empty desktop. | 481 // created browser window on an empty desktop. |
| 482 TEST_F(WindowSizerAshTest, PlaceNewBrowserWindowOnEmptyDesktop) { | 482 TEST_F(WindowSizerAshTest, PlaceNewBrowserWindowOnEmptyDesktop) { |
| 483 // Create a browser to pass into the GetWindowBoundsAndShowState function. | 483 // Create a browser to pass into the GetWindowBoundsAndShowState function. |
| 484 std::unique_ptr<TestingProfile> profile(new TestingProfile()); | 484 std::unique_ptr<TestingProfile> profile(new TestingProfile()); |
| 485 Browser::CreateParams native_params(profile.get()); | 485 Browser::CreateParams native_params(profile.get(), true); |
| 486 std::unique_ptr<Browser> browser( | 486 std::unique_ptr<Browser> browser( |
| 487 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 487 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
| 488 | 488 |
| 489 // A common screen size for Chrome OS devices where this behavior is | 489 // A common screen size for Chrome OS devices where this behavior is |
| 490 // desirable. | 490 // desirable. |
| 491 const gfx::Rect p1366x768(0, 0, 1366, 768); | 491 const gfx::Rect p1366x768(0, 0, 1366, 768); |
| 492 | 492 |
| 493 // If there is no previous state the window should get maximized if the | 493 // If there is no previous state the window should get maximized if the |
| 494 // screen is less than or equal to our limit (1366 pixels width). | 494 // screen is less than or equal to our limit (1366 pixels width). |
| 495 gfx::Rect window_bounds; | 495 gfx::Rect window_bounds; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { | 560 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { |
| 561 UpdateDisplay("1600x1200,1600x1200"); | 561 UpdateDisplay("1600x1200,1600x1200"); |
| 562 gfx::Rect primary_bounds = | 562 gfx::Rect primary_bounds = |
| 563 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 563 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
| 564 gfx::Rect secondary_bounds = | 564 gfx::Rect secondary_bounds = |
| 565 display_manager()->GetSecondaryDisplay().bounds(); | 565 display_manager()->GetSecondaryDisplay().bounds(); |
| 566 | 566 |
| 567 std::unique_ptr<TestingProfile> profile(new TestingProfile()); | 567 std::unique_ptr<TestingProfile> profile(new TestingProfile()); |
| 568 | 568 |
| 569 // Create browser windows that are used as reference. | 569 // Create browser windows that are used as reference. |
| 570 Browser::CreateParams params(profile.get()); | 570 Browser::CreateParams params(profile.get(), true); |
| 571 std::unique_ptr<Browser> browser(CreateTestBrowser( | 571 std::unique_ptr<Browser> browser(CreateTestBrowser( |
| 572 CreateTestWindowInShellWithId(0), gfx::Rect(10, 10, 200, 200), ¶ms)); | 572 CreateTestWindowInShellWithId(0), gfx::Rect(10, 10, 200, 200), ¶ms)); |
| 573 BrowserWindow* browser_window = browser->window(); | 573 BrowserWindow* browser_window = browser->window(); |
| 574 gfx::NativeWindow native_window = browser_window->GetNativeWindow(); | 574 gfx::NativeWindow native_window = browser_window->GetNativeWindow(); |
| 575 browser_window->Show(); | 575 browser_window->Show(); |
| 576 EXPECT_EQ(native_window->GetRootWindow(), ash::Shell::GetTargetRootWindow()); | 576 EXPECT_EQ(native_window->GetRootWindow(), ash::Shell::GetTargetRootWindow()); |
| 577 | 577 |
| 578 Browser::CreateParams another_params(profile.get()); | 578 Browser::CreateParams another_params(profile.get(), true); |
| 579 std::unique_ptr<Browser> another_browser( | 579 std::unique_ptr<Browser> another_browser( |
| 580 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 580 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
| 581 gfx::Rect(400, 10, 300, 300), &another_params)); | 581 gfx::Rect(400, 10, 300, 300), &another_params)); |
| 582 BrowserWindow* another_browser_window = another_browser->window(); | 582 BrowserWindow* another_browser_window = another_browser->window(); |
| 583 gfx::NativeWindow another_native_window = | 583 gfx::NativeWindow another_native_window = |
| 584 another_browser_window->GetNativeWindow(); | 584 another_browser_window->GetNativeWindow(); |
| 585 another_browser_window->Show(); | 585 another_browser_window->Show(); |
| 586 | 586 |
| 587 // Creating a new window to verify the new placement. | 587 // Creating a new window to verify the new placement. |
| 588 Browser::CreateParams new_params(profile.get()); | 588 Browser::CreateParams new_params(profile.get(), true); |
| 589 std::unique_ptr<Browser> new_browser(CreateTestBrowser( | 589 std::unique_ptr<Browser> new_browser(CreateTestBrowser( |
| 590 CreateTestWindowInShellWithId(0), gfx::Rect(), &new_params)); | 590 CreateTestWindowInShellWithId(0), gfx::Rect(), &new_params)); |
| 591 | 591 |
| 592 // Make sure the primary root is active. | 592 // Make sure the primary root is active. |
| 593 ASSERT_EQ(ash::Shell::GetPrimaryRootWindow(), | 593 ASSERT_EQ(ash::Shell::GetPrimaryRootWindow(), |
| 594 ash::Shell::GetTargetRootWindow()); | 594 ash::Shell::GetTargetRootWindow()); |
| 595 | 595 |
| 596 // First new window should be in the primary. | 596 // First new window should be in the primary. |
| 597 { | 597 { |
| 598 gfx::Rect window_bounds; | 598 gfx::Rect window_bounds; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 // RearrangeVisibleWindowOnShow. | 647 // RearrangeVisibleWindowOnShow. |
| 648 EXPECT_TRUE(primary_bounds.Contains(window_bounds)); | 648 EXPECT_TRUE(primary_bounds.Contains(window_bounds)); |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 // Test that the show state is properly returned for non default cases. | 652 // Test that the show state is properly returned for non default cases. |
| 653 TEST_F(WindowSizerAshTest, TestShowState) { | 653 TEST_F(WindowSizerAshTest, TestShowState) { |
| 654 std::unique_ptr<TestingProfile> profile(new TestingProfile()); | 654 std::unique_ptr<TestingProfile> profile(new TestingProfile()); |
| 655 | 655 |
| 656 // Creating a browser & window to play with. | 656 // Creating a browser & window to play with. |
| 657 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get()); | 657 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get(), true); |
| 658 std::unique_ptr<Browser> browser(CreateTestBrowser( | 658 std::unique_ptr<Browser> browser(CreateTestBrowser( |
| 659 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); | 659 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); |
| 660 | 660 |
| 661 // Create also a popup browser since that behaves different. | 661 // Create also a popup browser since that behaves different. |
| 662 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get()); | 662 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get(), true); |
| 663 std::unique_ptr<Browser> browser_popup( | 663 std::unique_ptr<Browser> browser_popup( |
| 664 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 664 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
| 665 gfx::Rect(16, 32, 640, 320), ¶ms_popup)); | 665 gfx::Rect(16, 32, 640, 320), ¶ms_popup)); |
| 666 | 666 |
| 667 // Tabbed windows should retrieve the saved window state - since there is a | 667 // Tabbed windows should retrieve the saved window state - since there is a |
| 668 // top window. | 668 // top window. |
| 669 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, | 669 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, |
| 670 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_NORMAL, | 670 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_NORMAL, |
| 671 BOTH, browser.get(), p1600x1200, p1600x1200)); | 671 BOTH, browser.get(), p1600x1200, p1600x1200)); |
| 672 // A window that is smaller than the whole work area is set to default state. | 672 // A window that is smaller than the whole work area is set to default state. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 684 browser_popup.get(), p1600x1200, p1600x1200)); | 684 browser_popup.get(), p1600x1200, p1600x1200)); |
| 685 // The non tabbed window will take the status of the last active of its kind. | 685 // The non tabbed window will take the status of the last active of its kind. |
| 686 EXPECT_EQ( | 686 EXPECT_EQ( |
| 687 ui::SHOW_STATE_NORMAL, | 687 ui::SHOW_STATE_NORMAL, |
| 688 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 688 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
| 689 browser_popup.get(), p1600x1200, p1600x1200)); | 689 browser_popup.get(), p1600x1200, p1600x1200)); |
| 690 | 690 |
| 691 // Now create a top level window and check again for both. Only the tabbed | 691 // Now create a top level window and check again for both. Only the tabbed |
| 692 // window should follow the top level window's state. | 692 // window should follow the top level window's state. |
| 693 // Creating a browser & window to play with. | 693 // Creating a browser & window to play with. |
| 694 Browser::CreateParams params2(Browser::TYPE_TABBED, profile.get()); | 694 Browser::CreateParams params2(Browser::TYPE_TABBED, profile.get(), true); |
| 695 std::unique_ptr<Browser> browser2(CreateTestBrowser( | 695 std::unique_ptr<Browser> browser2(CreateTestBrowser( |
| 696 CreateTestWindowInShellWithId(3), gfx::Rect(16, 32, 640, 320), ¶ms2)); | 696 CreateTestWindowInShellWithId(3), gfx::Rect(16, 32, 640, 320), ¶ms2)); |
| 697 | 697 |
| 698 // A tabbed window should now take the top level window state. | 698 // A tabbed window should now take the top level window state. |
| 699 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, | 699 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, |
| 700 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, | 700 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, |
| 701 BOTH, browser.get(), p1600x1200, p1600x1200)); | 701 BOTH, browser.get(), p1600x1200, p1600x1200)); |
| 702 // Non tabbed windows should always follow the window saved visibility state. | 702 // Non tabbed windows should always follow the window saved visibility state. |
| 703 EXPECT_EQ( | 703 EXPECT_EQ( |
| 704 ui::SHOW_STATE_MAXIMIZED, | 704 ui::SHOW_STATE_MAXIMIZED, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 720 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, | 720 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_DEFAULT, |
| 721 BOTH, browser2.get(), tiny_screen, tiny_screen)); | 721 BOTH, browser2.get(), tiny_screen, tiny_screen)); |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 | 724 |
| 725 // Test that the default show state override behavior is properly handled. | 725 // Test that the default show state override behavior is properly handled. |
| 726 TEST_F(WindowSizerAshTest, TestShowStateDefaults) { | 726 TEST_F(WindowSizerAshTest, TestShowStateDefaults) { |
| 727 // Creating a browser & window to play with. | 727 // Creating a browser & window to play with. |
| 728 std::unique_ptr<TestingProfile> profile(new TestingProfile()); | 728 std::unique_ptr<TestingProfile> profile(new TestingProfile()); |
| 729 | 729 |
| 730 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get()); | 730 Browser::CreateParams params(Browser::TYPE_TABBED, profile.get(), true); |
| 731 std::unique_ptr<Browser> browser(CreateTestBrowser( | 731 std::unique_ptr<Browser> browser(CreateTestBrowser( |
| 732 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); | 732 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), ¶ms)); |
| 733 | 733 |
| 734 // Create also a popup browser since that behaves slightly different for | 734 // Create also a popup browser since that behaves slightly different for |
| 735 // defaults. | 735 // defaults. |
| 736 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get()); | 736 Browser::CreateParams params_popup(Browser::TYPE_POPUP, profile.get(), true); |
| 737 std::unique_ptr<Browser> browser_popup( | 737 std::unique_ptr<Browser> browser_popup( |
| 738 CreateTestBrowser(CreateTestWindowInShellWithId(1), | 738 CreateTestBrowser(CreateTestWindowInShellWithId(1), |
| 739 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); | 739 gfx::Rect(16, 32, 128, 256), ¶ms_popup)); |
| 740 | 740 |
| 741 // Check that a browser creation state always get used if not given as | 741 // Check that a browser creation state always get used if not given as |
| 742 // SHOW_STATE_DEFAULT. On Windows ASH it should be SHOW_STATE_MAXIMIZED. | 742 // SHOW_STATE_DEFAULT. On Windows ASH it should be SHOW_STATE_MAXIMIZED. |
| 743 ui::WindowShowState window_show_state = | 743 ui::WindowShowState window_show_state = |
| 744 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_MAXIMIZED, | 744 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, ui::SHOW_STATE_MAXIMIZED, |
| 745 DEFAULT, browser.get(), p1600x1200, p1600x1200); | 745 DEFAULT, browser.get(), p1600x1200, p1600x1200); |
| 746 #if defined(OS_WIN) | 746 #if defined(OS_WIN) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 777 // The popup should favor the initial show state over the command line. | 777 // The popup should favor the initial show state over the command line. |
| 778 EXPECT_EQ( | 778 EXPECT_EQ( |
| 779 GetWindowShowState(ui::SHOW_STATE_NORMAL, ui::SHOW_STATE_NORMAL, BOTH, | 779 GetWindowShowState(ui::SHOW_STATE_NORMAL, ui::SHOW_STATE_NORMAL, BOTH, |
| 780 browser_popup.get(), p1600x1200, p1600x1200), | 780 browser_popup.get(), p1600x1200, p1600x1200), |
| 781 ui::SHOW_STATE_NORMAL); | 781 ui::SHOW_STATE_NORMAL); |
| 782 } | 782 } |
| 783 | 783 |
| 784 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { | 784 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { |
| 785 // Create a browser to pass into the GetWindowBounds function. | 785 // Create a browser to pass into the GetWindowBounds function. |
| 786 std::unique_ptr<TestingProfile> profile(new TestingProfile()); | 786 std::unique_ptr<TestingProfile> profile(new TestingProfile()); |
| 787 Browser::CreateParams native_params(profile.get()); | 787 Browser::CreateParams native_params(profile.get(), true); |
| 788 std::unique_ptr<Browser> browser( | 788 std::unique_ptr<Browser> browser( |
| 789 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 789 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
| 790 | 790 |
| 791 gfx::Rect display_bounds = | 791 gfx::Rect display_bounds = |
| 792 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 792 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
| 793 gfx::Rect specified_bounds = display_bounds; | 793 gfx::Rect specified_bounds = display_bounds; |
| 794 | 794 |
| 795 // Make a window bigger than the display work area. | 795 // Make a window bigger than the display work area. |
| 796 specified_bounds.Inset(-20, -20); | 796 specified_bounds.Inset(-20, -20); |
| 797 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; | 797 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 NULL, | 843 NULL, |
| 844 &bounds, | 844 &bounds, |
| 845 &show_state); | 845 &show_state); |
| 846 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); | 846 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); |
| 847 } | 847 } |
| 848 } | 848 } |
| 849 | 849 |
| 850 TEST_F(WindowSizerAshTest, TrustedPopupBehavior) { | 850 TEST_F(WindowSizerAshTest, TrustedPopupBehavior) { |
| 851 std::unique_ptr<TestingProfile> profile(new TestingProfile()); | 851 std::unique_ptr<TestingProfile> profile(new TestingProfile()); |
| 852 Browser::CreateParams trusted_popup_create_params(Browser::TYPE_POPUP, | 852 Browser::CreateParams trusted_popup_create_params(Browser::TYPE_POPUP, |
| 853 profile.get()); | 853 profile.get(), true); |
| 854 trusted_popup_create_params.trusted_source = true; | 854 trusted_popup_create_params.trusted_source = true; |
| 855 | 855 |
| 856 std::unique_ptr<Browser> trusted_popup(CreateTestBrowser( | 856 std::unique_ptr<Browser> trusted_popup(CreateTestBrowser( |
| 857 CreateTestWindowInShellWithId(1), gfx::Rect(16, 32, 640, 320), | 857 CreateTestWindowInShellWithId(1), gfx::Rect(16, 32, 640, 320), |
| 858 &trusted_popup_create_params)); | 858 &trusted_popup_create_params)); |
| 859 // Trusted popup windows should follow the saved show state and ignore the | 859 // Trusted popup windows should follow the saved show state and ignore the |
| 860 // last show state. | 860 // last show state. |
| 861 EXPECT_EQ( | 861 EXPECT_EQ( |
| 862 ui::SHOW_STATE_DEFAULT, | 862 ui::SHOW_STATE_DEFAULT, |
| 863 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 863 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
| 864 trusted_popup.get(), p1280x1024, p1600x1200)); | 864 trusted_popup.get(), p1280x1024, p1600x1200)); |
| 865 // A popup that is sized to occupy the whole work area has default state. | 865 // A popup that is sized to occupy the whole work area has default state. |
| 866 EXPECT_EQ( | 866 EXPECT_EQ( |
| 867 ui::SHOW_STATE_DEFAULT, | 867 ui::SHOW_STATE_DEFAULT, |
| 868 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 868 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
| 869 trusted_popup.get(), p1600x1200, p1600x1200)); | 869 trusted_popup.get(), p1600x1200, p1600x1200)); |
| 870 } | 870 } |
| OLD | NEW |