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/scoped_target_root_window.h" | 5 #include "ash/scoped_target_root_window.h" |
6 #include "ash/screen_ash.h" | 6 #include "ash/screen_util.h" |
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_positioner.h" | 10 #include "ash/wm/window_positioner.h" |
11 #include "ash/wm/window_resizer.h" | 11 #include "ash/wm/window_resizer.h" |
12 #include "ash/wm/window_state.h" | 12 #include "ash/wm/window_state.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "chrome/browser/ui/ash/ash_init.h" | 14 #include "chrome/browser/ui/ash/ash_init.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" | 16 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
19 #include "content/public/test/render_view_test.h" | 19 #include "content/public/test/render_view_test.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/aura/client/activation_client.h" | 21 #include "ui/aura/client/activation_client.h" |
22 #include "ui/aura/client/aura_constants.h" | 22 #include "ui/aura/client/aura_constants.h" |
23 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
24 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
25 #include "ui/aura/test/test_windows.h" | 25 #include "ui/aura/test/test_windows.h" |
| 26 #include "ui/gfx/screen.h" |
26 | 27 |
27 typedef ash::test::AshTestBase WindowSizerAshTest; | 28 typedef ash::test::AshTestBase WindowSizerAshTest; |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 // A browser window proxy which is able to associate an aura native window with | 32 // A browser window proxy which is able to associate an aura native window with |
32 // it. | 33 // it. |
33 class TestBrowserWindowAura : public TestBrowserWindow { | 34 class TestBrowserWindowAura : public TestBrowserWindow { |
34 public: | 35 public: |
35 // |native_window| will still be owned by the caller after the constructor | 36 // |native_window| will still be owned by the caller after the constructor |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 #else | 601 #else |
601 // No multiple displays on windows ash. | 602 // No multiple displays on windows ash. |
602 #define MAYBE_PlaceNewWindowsOnMultipleDisplays DISABLED_PlaceNewWindowsOnMultip
leDisplays | 603 #define MAYBE_PlaceNewWindowsOnMultipleDisplays DISABLED_PlaceNewWindowsOnMultip
leDisplays |
603 #endif | 604 #endif |
604 | 605 |
605 // Test the placement of newly created windows on multiple dislays. | 606 // Test the placement of newly created windows on multiple dislays. |
606 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { | 607 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { |
607 UpdateDisplay("1600x1200,1600x1200"); | 608 UpdateDisplay("1600x1200,1600x1200"); |
608 gfx::Rect primary_bounds = ash::Shell::GetInstance()->GetScreen()-> | 609 gfx::Rect primary_bounds = ash::Shell::GetInstance()->GetScreen()-> |
609 GetPrimaryDisplay().bounds(); | 610 GetPrimaryDisplay().bounds(); |
610 gfx::Rect secondary_bounds = ash::ScreenAsh::GetSecondaryDisplay().bounds(); | 611 gfx::Rect secondary_bounds = ash::ScreenUtil::GetSecondaryDisplay().bounds(); |
611 | 612 |
612 ash::Shell::GetInstance()->set_target_root_window( | 613 ash::Shell::GetInstance()->set_target_root_window( |
613 ash::Shell::GetPrimaryRootWindow()); | 614 ash::Shell::GetPrimaryRootWindow()); |
614 | 615 |
615 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 616 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
616 | 617 |
617 // Create browser windows that are used as reference. | 618 // Create browser windows that are used as reference. |
618 scoped_ptr<BrowserWindow> browser_window(CreateTestBrowserWindow( | 619 scoped_ptr<BrowserWindow> browser_window(CreateTestBrowserWindow( |
619 CreateTestWindowInShellWithId(0), | 620 CreateTestWindowInShellWithId(0), |
620 gfx::Rect(10, 10, 200, 200), | 621 gfx::Rect(10, 10, 200, 200), |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 ui::WindowShowState show_state; | 891 ui::WindowShowState show_state; |
891 WindowSizer::GetBrowserWindowBoundsAndShowState( | 892 WindowSizer::GetBrowserWindowBoundsAndShowState( |
892 std::string(), | 893 std::string(), |
893 gfx::Rect(), | 894 gfx::Rect(), |
894 NULL, | 895 NULL, |
895 &bounds, | 896 &bounds, |
896 &show_state); | 897 &show_state); |
897 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); | 898 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); |
898 } | 899 } |
899 } | 900 } |
OLD | NEW |