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" |
| 11 #include "ash/wm/window_util.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
15 #include "content/public/test/render_view_test.h" | 16 #include "content/public/test/render_view_test.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
18 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
19 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
20 #include "ui/aura/root_window.h" | 21 #include "ui/aura/root_window.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 scoped_ptr<Browser> panel_owning_browser(new Browser(panel_params)); | 489 scoped_ptr<Browser> panel_owning_browser(new Browser(panel_params)); |
489 | 490 |
490 window->Show(); | 491 window->Show(); |
491 { // With a shown window it's size should get returned. | 492 { // With a shown window it's size should get returned. |
492 gfx::Rect window_bounds; | 493 gfx::Rect window_bounds; |
493 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), | 494 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), |
494 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, | 495 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, |
495 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); | 496 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); |
496 // The position should be right flush. | 497 // The position should be right flush. |
497 EXPECT_EQ("384,32 640x320", window_bounds.ToString()); | 498 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 } | 499 } |
501 | 500 |
502 { // With the window shown - but more on the right side then on the left | 501 { // 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 | 502 // side (and partially out of the screen), it should default to the other |
504 // side and inside the screen. | 503 // side and inside the screen. |
505 window->SetBounds(gfx::Rect(350, 600, 640, 320)); | 504 window->SetBounds(gfx::Rect(350, 600, 640, 320)); |
506 gfx::Rect window_bounds; | 505 gfx::Rect window_bounds; |
507 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), | 506 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), |
508 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, | 507 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, |
509 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); | 508 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); |
510 // The position should be left & bottom flush. | 509 // The position should be left & bottom flush. |
511 EXPECT_EQ("0,448 640x320", window_bounds.ToString()); | 510 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 } | 511 } |
515 | 512 |
516 { // If the second windows right side is already over the right side of the | 513 { // If the second windows right side is already over the right side of the |
517 // screen, it will not move back into the screen. | 514 // screen, it will not move back into the screen. |
518 window->SetBounds(gfx::Rect(1000, 600, 640, 320)); | 515 window->SetBounds(gfx::Rect(1000, 600, 640, 320)); |
519 gfx::Rect window_bounds; | 516 gfx::Rect window_bounds; |
520 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), | 517 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), |
521 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, | 518 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, |
522 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); | 519 PERSISTED, browser.get(), gfx::Rect(), &window_bounds); |
523 // The position should be left & bottom flush. | 520 // 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, | 691 ui::SHOW_STATE_NORMAL, |
695 BOTH, | 692 BOTH, |
696 browser.get()), ui::SHOW_STATE_MAXIMIZED); | 693 browser.get()), ui::SHOW_STATE_MAXIMIZED); |
697 | 694 |
698 // The popup should favor the initial show state over the command line. | 695 // The popup should favor the initial show state over the command line. |
699 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, | 696 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, |
700 ui::SHOW_STATE_NORMAL, | 697 ui::SHOW_STATE_NORMAL, |
701 BOTH, | 698 BOTH, |
702 popup_browser.get()), ui::SHOW_STATE_NORMAL); | 699 popup_browser.get()), ui::SHOW_STATE_NORMAL); |
703 } | 700 } |
OLD | NEW |