Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc

Issue 11085053: Improving window auto management between workspaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved the entire window (auto) management Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 scoped_ptr<Browser> panel_owning_browser(new Browser(panel_params)); 677 scoped_ptr<Browser> panel_owning_browser(new Browser(panel_params));
677 678
678 window->Show(); 679 window->Show();
679 { // With a shown window it's size should get returned. 680 { // With a shown window it's size should get returned.
680 gfx::Rect window_bounds; 681 gfx::Rect window_bounds;
681 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), 682 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
682 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, 683 gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
683 PERSISTED, &window_bounds, browser.get(), gfx::Rect()); 684 PERSISTED, &window_bounds, browser.get(), gfx::Rect());
684 // The position should be right flush. 685 // The position should be right flush.
685 EXPECT_EQ("384,32 640x320", window_bounds.ToString()); 686 EXPECT_EQ("384,32 640x320", window_bounds.ToString());
686 // In addition the other window should have moved left flush.
687 EXPECT_EQ("0,32 640x320", window->bounds().ToString());
688 } 687 }
689 688
690 { // With the window shown - but more on the right side then on the left 689 { // With the window shown - but more on the right side then on the left
691 // side (and partially out of the screen), it should default to the other 690 // side (and partially out of the screen), it should default to the other
692 // side and inside the screen. 691 // side and inside the screen.
693 window->SetBounds(gfx::Rect(350, 600, 640, 320)); 692 window->SetBounds(gfx::Rect(350, 600, 640, 320));
694 gfx::Rect window_bounds; 693 gfx::Rect window_bounds;
695 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), 694 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
696 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, 695 gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
697 PERSISTED, &window_bounds, browser.get(), gfx::Rect()); 696 PERSISTED, &window_bounds, browser.get(), gfx::Rect());
698 // The position should be left & bottom flush. 697 // The position should be left & bottom flush.
699 EXPECT_EQ("0,448 640x320", window_bounds.ToString()); 698 EXPECT_EQ("0,448 640x320", window_bounds.ToString());
700 // In addition the other window should have moved right flush.
701 EXPECT_EQ("384,600 640x320", window->bounds().ToString());
702 } 699 }
703 700
704 { // If the second windows right side is already over the right side of the 701 { // If the second windows right side is already over the right side of the
705 // screen, it will not move back into the screen. 702 // screen, it will not move back into the screen.
706 window->SetBounds(gfx::Rect(1000, 600, 640, 320)); 703 window->SetBounds(gfx::Rect(1000, 600, 640, 320));
707 gfx::Rect window_bounds; 704 gfx::Rect window_bounds;
708 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), 705 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
709 gfx::Rect(50, 100, 300, 150), bottom_nonprimary, 706 gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
710 PERSISTED, &window_bounds, browser.get(), gfx::Rect()); 707 PERSISTED, &window_bounds, browser.get(), gfx::Rect());
711 // The position should be left & bottom flush. 708 // The position should be left & bottom flush.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 ui::SHOW_STATE_NORMAL, 899 ui::SHOW_STATE_NORMAL,
903 BOTH, 900 BOTH,
904 browser.get()), ui::SHOW_STATE_MAXIMIZED); 901 browser.get()), ui::SHOW_STATE_MAXIMIZED);
905 902
906 // The popup should favor the initial show state over the command line. 903 // The popup should favor the initial show state over the command line.
907 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, 904 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL,
908 ui::SHOW_STATE_NORMAL, 905 ui::SHOW_STATE_NORMAL,
909 BOTH, 906 BOTH,
910 popup_browser.get()), ui::SHOW_STATE_NORMAL); 907 popup_browser.get()), ui::SHOW_STATE_NORMAL);
911 } 908 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698