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

Side by Side Diff: ash/wm/workspace/workspace_manager_unittest.cc

Issue 9515003: Fix the full screen switching browser window dipping below launcher bar issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the issue for managed window mode, add tests. Created 8 years, 9 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 "ash/wm/workspace/workspace_manager.h" 5 #include "ash/wm/workspace/workspace_manager.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/activation_controller.h" 10 #include "ash/wm/activation_controller.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Should be 1 workspace, TYPE_NORMAL with w1. 153 // Should be 1 workspace, TYPE_NORMAL with w1.
154 ASSERT_EQ(1u, workspaces().size()); 154 ASSERT_EQ(1u, workspaces().size());
155 EXPECT_EQ(Workspace::TYPE_MANAGED, workspaces()[0]->type()); 155 EXPECT_EQ(Workspace::TYPE_MANAGED, workspaces()[0]->type());
156 ASSERT_EQ(1u, workspaces()[0]->windows().size()); 156 ASSERT_EQ(1u, workspaces()[0]->windows().size());
157 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]); 157 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]);
158 EXPECT_EQ(250, w1->bounds().width()); 158 EXPECT_EQ(250, w1->bounds().width());
159 EXPECT_EQ(251, w1->bounds().height()); 159 EXPECT_EQ(251, w1->bounds().height());
160 } 160 }
161 161
162 // Assertions around maximized window resizing on work area insets change.
163 TEST_F(WorkspaceManagerTest, ResizeMaximizedWindowOnWorkAreaInsetsChange) {
164 scoped_ptr<Window> w1(CreateTestWindow());
165 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
166
167 ASSERT_TRUE(manager_->IsManagedWindow(w1.get()));
168
169 w1->Show();
170
171 ASSERT_TRUE(w1->layer() != NULL);
172 EXPECT_TRUE(w1->layer()->visible());
173
174 EXPECT_EQ(250, w1->bounds().width());
175 EXPECT_EQ(251, w1->bounds().height());
176
177 // Maximize the window.
178 Shell::GetRootWindow()->SetScreenWorkAreaInsets(
179 gfx::Insets(0, 0, 30, 0));
180 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
181
182 // Should be 1 workspace, TYPE_MAXIMIZED with w1, fills the work area bounds.
183 ASSERT_EQ(1u, workspaces().size());
184 EXPECT_EQ(Workspace::TYPE_MAXIMIZED, workspaces()[0]->type());
185 ASSERT_EQ(1u, workspaces()[0]->windows().size());
186 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]);
187 EXPECT_EQ(GetWorkAreaBounds().width(), w1->bounds().width());
188 EXPECT_EQ(GetWorkAreaBounds().height(), w1->bounds().height());
189
190 // Change work area insets.
191 Shell::GetRootWindow()->SetScreenWorkAreaInsets(
192 gfx::Insets(0, 0, 60, 0));
193
194 // Should be 1 workspace, TYPE_MAXIMIZED with w1, fills the changed work
195 // area bounds.
196 ASSERT_EQ(1u, workspaces().size());
197 EXPECT_EQ(Workspace::TYPE_MAXIMIZED, workspaces()[0]->type());
198 ASSERT_EQ(1u, workspaces()[0]->windows().size());
199 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]);
200 EXPECT_EQ(GetWorkAreaBounds().width(), w1->bounds().width());
201 EXPECT_EQ(GetWorkAreaBounds().height(), w1->bounds().height());
202 }
203
162 // Assertions around closing the last window in a workspace. 204 // Assertions around closing the last window in a workspace.
163 TEST_F(WorkspaceManagerTest, CloseLastWindowInWorkspace) { 205 TEST_F(WorkspaceManagerTest, CloseLastWindowInWorkspace) {
164 scoped_ptr<Window> w1(CreateTestWindow()); 206 scoped_ptr<Window> w1(CreateTestWindow());
165 scoped_ptr<Window> w2(CreateTestWindow()); 207 scoped_ptr<Window> w2(CreateTestWindow());
166 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 208 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
167 w1->Show(); 209 w1->Show();
168 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 210 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
169 w2->Show(); 211 w2->Show();
170 212
171 // Should be 2 workspaces, TYPE_NORMAL with w1, and TYPE_MAXIMIZED with w2. 213 // Should be 2 workspaces, TYPE_NORMAL with w1, and TYPE_MAXIMIZED with w2.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ASSERT_EQ(1u, workspaces()[0]->windows().size()); 433 ASSERT_EQ(1u, workspaces()[0]->windows().size());
392 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]); 434 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]);
393 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width()); 435 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width());
394 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height()); 436 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height());
395 ASSERT_TRUE(GetRestoreBounds(w1.get())); 437 ASSERT_TRUE(GetRestoreBounds(w1.get()));
396 EXPECT_EQ(gfx::Rect(0, 0, 250, 251), *GetRestoreBounds(w1.get())); 438 EXPECT_EQ(gfx::Rect(0, 0, 250, 251), *GetRestoreBounds(w1.get()));
397 } 439 }
398 440
399 } // namespace internal 441 } // namespace internal
400 } // namespace ash 442 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698