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

Side by Side Diff: ash/wm/window_state_unittest.cc

Issue 424463002: Makes a window that has been resized to maximized bounds, then maximized and then restored shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maximizes a window that has been resized to maximized bounds (nits, restricts to tabbed browsers) Created 6 years, 4 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
« no previous file with comments | « ash/wm/default_state.cc ('k') | chrome/browser/ui/window_sizer/window_sizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/window_state.h" 5 #include "ash/wm/window_state.h"
6 6
7 #include "ash/screen_util.h" 7 #include "ash/screen_util.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 WindowState* window_state = GetWindowState(window.get()); 305 WindowState* window_state = GetWindowState(window.get());
306 EXPECT_FALSE(window_state->IsMaximized()); 306 EXPECT_FALSE(window_state->IsMaximized());
307 scoped_ptr<WindowState::State> old(window_state->SetStateObject( 307 scoped_ptr<WindowState::State> old(window_state->SetStateObject(
308 scoped_ptr<WindowState::State> (new AlwaysMaximizeTestState( 308 scoped_ptr<WindowState::State> (new AlwaysMaximizeTestState(
309 window_state->GetStateType()))).Pass()); 309 window_state->GetStateType()))).Pass());
310 EXPECT_TRUE(window_state->IsMaximized()); 310 EXPECT_TRUE(window_state->IsMaximized());
311 window_state->SetStateObject(old.Pass()); 311 window_state->SetStateObject(old.Pass());
312 EXPECT_FALSE(window_state->IsMaximized()); 312 EXPECT_FALSE(window_state->IsMaximized());
313 } 313 }
314 314
315 // Tests that a window that had same bounds as the work area shrinks after the
316 // window is maximized and then restored.
317 TEST_F(WindowStateTest, RestoredWindowBoundsShrink) {
318 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
319 WindowState* window_state = GetWindowState(window.get());
320 EXPECT_FALSE(window_state->IsMaximized());
321 gfx::Rect work_area =
322 ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
323
324 window->SetBounds(work_area);
325 window_state->Maximize();
326 EXPECT_TRUE(window_state->IsMaximized());
327 EXPECT_EQ(work_area.ToString(), window->bounds().ToString());
328
329 window_state->Restore();
330 EXPECT_FALSE(window_state->IsMaximized());
331 EXPECT_NE(work_area.ToString(), window->bounds().ToString());
332 EXPECT_TRUE(work_area.Contains(window->bounds()));
333 }
334
315 // TODO(skuhne): Add more unit test to verify the correctness for the restore 335 // TODO(skuhne): Add more unit test to verify the correctness for the restore
316 // operation. 336 // operation.
317 337
318 } // namespace wm 338 } // namespace wm
319 } // namespace ash 339 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/default_state.cc ('k') | chrome/browser/ui/window_sizer/window_sizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698