Chromium Code Reviews| 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/session_state_delegate.h" | 7 #include "ash/session_state_delegate.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); | 146 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); |
| 147 maximized->Maximize(); | 147 maximized->Maximize(); |
| 148 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); | 148 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); |
| 149 EXPECT_EQ("600,0 300x253", maximized->GetWindowBoundsInScreen().ToString()); | 149 EXPECT_EQ("600,0 300x253", maximized->GetWindowBoundsInScreen().ToString()); |
| 150 EXPECT_EQ("0,0 300x253", | 150 EXPECT_EQ("0,0 300x253", |
| 151 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); | 151 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 152 | 152 |
| 153 views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); | 153 views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); |
| 154 minimized->Minimize(); | 154 minimized->Minimize(); |
| 155 EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); | 155 EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); |
| 156 EXPECT_EQ("800,10 100x100", | 156 EXPECT_TRUE(minimized->GetWindowBoundsInScreen().IsEmpty()); |
|
oshima
2014/02/20 19:39:35
Do you know why this becomes empty? AFAIK, the min
sadrul
2014/02/20 19:59:59
A transform is applied on he window on minimize, w
oshima
2014/02/20 20:18:51
Ah, I think it's coming from minimize animation. L
| |
| 157 minimized->GetWindowBoundsInScreen().ToString()); | |
| 158 | 157 |
| 159 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(850, 10, 100, 100)); | 158 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(850, 10, 100, 100)); |
| 160 fullscreen->SetFullscreen(true); | 159 fullscreen->SetFullscreen(true); |
| 161 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); | 160 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); |
| 162 | 161 |
| 163 EXPECT_EQ("600,0 300x300", | 162 EXPECT_EQ("600,0 300x300", |
| 164 fullscreen->GetWindowBoundsInScreen().ToString()); | 163 fullscreen->GetWindowBoundsInScreen().ToString()); |
| 165 EXPECT_EQ("0,0 300x300", | 164 EXPECT_EQ("0,0 300x300", |
| 166 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); | 165 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 167 | 166 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 // Set fullscreen to true. In that case the 3px inset becomes invisible so | 215 // Set fullscreen to true. In that case the 3px inset becomes invisible so |
| 217 // the maximized window can also use the area fully. | 216 // the maximized window can also use the area fully. |
| 218 fullscreen->SetFullscreen(true); | 217 fullscreen->SetFullscreen(true); |
| 219 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); | 218 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); |
| 220 EXPECT_EQ("0,0 600x600", | 219 EXPECT_EQ("0,0 600x600", |
| 221 maximized->GetWindowBoundsInScreen().ToString()); | 220 maximized->GetWindowBoundsInScreen().ToString()); |
| 222 EXPECT_EQ("0,0 600x600", | 221 EXPECT_EQ("0,0 600x600", |
| 223 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); | 222 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 224 | 223 |
| 225 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); | 224 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); |
| 226 EXPECT_EQ("400,20 100x100", | 225 EXPECT_TRUE(minimized->GetWindowBoundsInScreen().IsEmpty()); |
| 227 minimized->GetWindowBoundsInScreen().ToString()); | |
| 228 | 226 |
| 229 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); | 227 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); |
| 230 EXPECT_TRUE(fullscreen->IsFullscreen()); | 228 EXPECT_TRUE(fullscreen->IsFullscreen()); |
| 231 EXPECT_EQ("0,0 600x600", | 229 EXPECT_EQ("0,0 600x600", |
| 232 fullscreen->GetWindowBoundsInScreen().ToString()); | 230 fullscreen->GetWindowBoundsInScreen().ToString()); |
| 233 EXPECT_EQ("0,0 600x600", | 231 EXPECT_EQ("0,0 600x600", |
| 234 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); | 232 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 235 | 233 |
| 236 // Test if the restore bounds are correctly updated. | 234 // Test if the restore bounds are correctly updated. |
| 237 wm::GetWindowState(maximized->GetNativeView())->Restore(); | 235 wm::GetWindowState(maximized->GetNativeView())->Restore(); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); | 683 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
| 686 EXPECT_LT(after, before); | 684 EXPECT_LT(after, before); |
| 687 | 685 |
| 688 // Mock a login user profile change to reinitialize the keyboard. | 686 // Mock a login user profile change to reinitialize the keyboard. |
| 689 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 687 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
| 690 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); | 688 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); |
| 691 } | 689 } |
| 692 | 690 |
| 693 } // namespace test | 691 } // namespace test |
| 694 } // namespace ash | 692 } // namespace ash |
| OLD | NEW |