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 "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
6 | 6 |
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_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 scoped_ptr<Browser> panel_owning_browser(new Browser(panel_params)); | 488 scoped_ptr<Browser> panel_owning_browser(new Browser(panel_params)); |
489 | 489 |
490 window->Show(); | 490 window->Show(); |
491 { // With a shown window it's size should get returned. | 491 { // With a shown window it's size should get returned. |
492 gfx::Rect window_bounds; | 492 gfx::Rect window_bounds; |
493 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), | 493 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), |
494 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, | 494 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, |
495 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); | 495 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); |
496 // The position should be right flush. | 496 // The position should be right flush. |
497 EXPECT_EQ("384,32 640x320", window_bounds.ToString()); | 497 EXPECT_EQ("384,32 640x320", window_bounds.ToString()); |
498 // In addition the other window should have moved left flush. | |
499 EXPECT_EQ("0,32 640x320", window->bounds().ToString()); | |
500 } | 498 } |
501 | 499 |
502 { // With the window shown - but more on the right side then on the left | 500 { // With the window shown - but more on the right side then on the left |
503 // side (and partially out of the screen), it should default to the other | 501 // side (and partially out of the screen), it should default to the other |
504 // side and inside the screen. | 502 // side and inside the screen. |
505 window->SetBounds(gfx::Rect(350, 600, 640, 320)); | 503 window->SetBounds(gfx::Rect(350, 600, 640, 320)); |
506 gfx::Rect window_bounds; | 504 gfx::Rect window_bounds; |
507 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), | 505 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), |
508 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, | 506 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, |
509 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); | 507 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); |
510 // The position should be left & bottom flush. | 508 // The position should be left & bottom flush. |
511 EXPECT_EQ("0,448 640x320", window_bounds.ToString()); | 509 EXPECT_EQ("0,448 640x320", window_bounds.ToString()); |
512 // In addition the other window should have moved right flush. | |
513 EXPECT_EQ("384,600 640x320", window->bounds().ToString()); | |
514 } | 510 } |
515 | 511 |
516 { // If the second windows right side is already over the right side of the | 512 { // If the second windows right side is already over the right side of the |
517 // screen, it will not move back into the screen. | 513 // screen, it will not move back into the screen. |
518 window->SetBounds(gfx::Rect(1000, 600, 640, 320)); | 514 window->SetBounds(gfx::Rect(1000, 600, 640, 320)); |
519 gfx::Rect window_bounds; | 515 gfx::Rect window_bounds; |
520 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), | 516 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), |
521 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, | 517 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, |
522 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); | 518 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); |
523 // The position should be left & bottom flush. | 519 // The position should be left & bottom flush. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 ui::SHOW_STATE_NORMAL, | 690 ui::SHOW_STATE_NORMAL, |
695 BOTH, | 691 BOTH, |
696 browser.get()), ui::SHOW_STATE_MAXIMIZED); | 692 browser.get()), ui::SHOW_STATE_MAXIMIZED); |
697 | 693 |
698 // The popup should favor the initial show state over the command line. | 694 // The popup should favor the initial show state over the command line. |
699 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, | 695 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, |
700 ui::SHOW_STATE_NORMAL, | 696 ui::SHOW_STATE_NORMAL, |
701 BOTH, | 697 BOTH, |
702 popup_browser.get()), ui::SHOW_STATE_NORMAL); | 698 popup_browser.get()), ui::SHOW_STATE_NORMAL); |
703 } | 699 } |
OLD | NEW |