| 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/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 scoped_ptr<aura::Window> window( | 132 scoped_ptr<aura::Window> window( |
| 133 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); | 133 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); |
| 134 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 134 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 135 | 135 |
| 136 SetRestoreBoundsInScreen(window.get(), gfx::Rect(400, 0, 30, 40)); | 136 SetRestoreBoundsInScreen(window.get(), gfx::Rect(400, 0, 30, 40)); |
| 137 // Maximize the window in 2nd display as the restore bounds | 137 // Maximize the window in 2nd display as the restore bounds |
| 138 // is inside 2nd display. | 138 // is inside 2nd display. |
| 139 wm::MaximizeWindow(window.get()); | 139 wm::MaximizeWindow(window.get()); |
| 140 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 140 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 141 EXPECT_EQ("300,0 400x452", window->GetBoundsInScreen().ToString()); | 141 EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString()); |
| 142 | 142 |
| 143 wm::RestoreWindow(window.get()); | 143 wm::RestoreWindow(window.get()); |
| 144 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 144 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 145 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString()); | 145 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString()); |
| 146 | 146 |
| 147 // If the restore bounds intersects with the current display, | 147 // If the restore bounds intersects with the current display, |
| 148 // don't move. | 148 // don't move. |
| 149 SetRestoreBoundsInScreen(window.get(), gfx::Rect(280, 0, 30, 40)); | 149 SetRestoreBoundsInScreen(window.get(), gfx::Rect(280, 0, 30, 40)); |
| 150 wm::MaximizeWindow(window.get()); | 150 wm::MaximizeWindow(window.get()); |
| 151 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 151 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 152 EXPECT_EQ("300,0 400x452", window->GetBoundsInScreen().ToString()); | 152 EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString()); |
| 153 | 153 |
| 154 wm::RestoreWindow(window.get()); | 154 wm::RestoreWindow(window.get()); |
| 155 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 155 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 156 EXPECT_EQ("280,0 30x40", window->GetBoundsInScreen().ToString()); | 156 EXPECT_EQ("280,0 30x40", window->GetBoundsInScreen().ToString()); |
| 157 | 157 |
| 158 // Restoring widget state. | 158 // Restoring widget state. |
| 159 scoped_ptr<views::Widget> w1(new views::Widget); | 159 scoped_ptr<views::Widget> w1(new views::Widget); |
| 160 views::Widget::InitParams params; | 160 views::Widget::InitParams params; |
| 161 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 161 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 162 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40)); | 162 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40)); |
| 163 params.context = root_windows[0]; | 163 params.context = root_windows[0]; |
| 164 w1->Init(params); | 164 w1->Init(params); |
| 165 w1->Show(); | 165 w1->Show(); |
| 166 EXPECT_TRUE(w1->IsMaximized()); | 166 EXPECT_TRUE(w1->IsMaximized()); |
| 167 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); | 167 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); |
| 168 EXPECT_EQ("300,0 400x452", w1->GetWindowBoundsInScreen().ToString()); | 168 EXPECT_EQ("300,0 400x453", w1->GetWindowBoundsInScreen().ToString()); |
| 169 w1->Restore(); | 169 w1->Restore(); |
| 170 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); | 170 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); |
| 171 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); | 171 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { | 174 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { |
| 175 if (!SupportsMultipleDisplays()) | 175 if (!SupportsMultipleDisplays()) |
| 176 return; | 176 return; |
| 177 UpdateDisplay("300x400,400x500"); | 177 UpdateDisplay("300x400,400x500"); |
| 178 | 178 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 window->bounds().ToString()); | 362 window->bounds().ToString()); |
| 363 | 363 |
| 364 // Directly setting the bounds triggers a slightly different code path. Verify | 364 // Directly setting the bounds triggers a slightly different code path. Verify |
| 365 // that too. | 365 // that too. |
| 366 window->SetBounds(window_bounds); | 366 window->SetBounds(window_bounds); |
| 367 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 367 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
| 368 window->bounds().ToString()); | 368 window->bounds().ToString()); |
| 369 } | 369 } |
| 370 | 370 |
| 371 } // namespace ash | 371 } // namespace ash |
| OLD | NEW |