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

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

Issue 102773002: Open non browser window on the target display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: exclude win7 Created 7 years 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 "ash/scoped_target_root_window.h"
5 #include "ash/screen_ash.h" 6 #include "ash/screen_ash.h"
6 #include "ash/shell.h" 7 #include "ash/shell.h"
7 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
8 #include "ash/test/test_shell_delegate.h" 9 #include "ash/test/test_shell_delegate.h"
9 #include "ash/wm/window_positioner.h" 10 #include "ash/wm/window_positioner.h"
10 #include "ash/wm/window_resizer.h" 11 #include "ash/wm/window_resizer.h"
11 #include "ash/wm/window_state.h" 12 #include "ash/wm/window_state.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "chrome/browser/ui/ash/ash_init.h"
13 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" 16 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h"
15 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
16 #include "chrome/test/base/testing_profile.h" 18 #include "chrome/test/base/testing_profile.h"
17 #include "content/public/test/render_view_test.h" 19 #include "content/public/test/render_view_test.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/aura/client/activation_client.h" 21 #include "ui/aura/client/activation_client.h"
20 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
21 #include "ui/aura/env.h" 23 #include "ui/aura/env.h"
22 #include "ui/aura/root_window.h" 24 #include "ui/aura/root_window.h"
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 browser_window->browser(), 850 browser_window->browser(),
849 p1600x1200), ui::SHOW_STATE_MAXIMIZED); 851 p1600x1200), ui::SHOW_STATE_MAXIMIZED);
850 852
851 // The popup should favor the initial show state over the command line. 853 // The popup should favor the initial show state over the command line.
852 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, 854 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL,
853 ui::SHOW_STATE_NORMAL, 855 ui::SHOW_STATE_NORMAL,
854 BOTH, 856 BOTH,
855 browser_popup->browser(), 857 browser_popup->browser(),
856 p1600x1200), ui::SHOW_STATE_NORMAL); 858 p1600x1200), ui::SHOW_STATE_NORMAL);
857 } 859 }
860
861 // Test that the target root window is used as the destionation of
862 // the non browser window. This differ from PersistedBoundsCase
863 // in that this uses real ash shell implementations + StateProvider
864 // TargetDisplayProvider, rather than mocks.
865 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) {
866 if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup())
867 return;
868 UpdateDisplay("500x500,600x600");
869 {
870 aura::Window* first_root =
871 ash::Shell::GetAllRootWindows()[0];
872 ash::internal::ScopedTargetRootWindow tmp(
873 first_root);
874 gfx::Rect bounds;
875 ui::WindowShowState show_state;
876 WindowSizer::GetBrowserWindowBoundsAndShowState(
877 std::string(),
878 gfx::Rect(),
879 NULL,
880 &bounds,
881 &show_state);
882 EXPECT_TRUE(first_root->GetBoundsInScreen().Contains(bounds));
883 }
884 {
885 aura::Window* second_root =
886 ash::Shell::GetAllRootWindows()[1];
887 ash::internal::ScopedTargetRootWindow tmp(
888 second_root);
889 gfx::Rect bounds;
890 ui::WindowShowState show_state;
891 WindowSizer::GetBrowserWindowBoundsAndShowState(
892 std::string(),
893 gfx::Rect(),
894 NULL,
895 &bounds,
896 &show_state);
897 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds));
898 }
899 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer/window_sizer_ash.cc ('k') | chrome/browser/ui/window_sizer/window_sizer_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698