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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc

Issue 249723002: Fixing problem where applications are not getting centered when created after maximize mode starts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 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/maximize_mode/maximize_mode_window_manager.h" 5 #include "ash/wm/maximize_mode/maximize_mode_window_manager.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/switchable_windows.h" 9 #include "ash/switchable_windows.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 CreateFixedSizeNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect3)); 264 CreateFixedSizeNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect3));
265 scoped_ptr<aura::Window> w4(CreateWindow(ui::wm::WINDOW_TYPE_PANEL, rect)); 265 scoped_ptr<aura::Window> w4(CreateWindow(ui::wm::WINDOW_TYPE_PANEL, rect));
266 scoped_ptr<aura::Window> w5(CreateWindow(ui::wm::WINDOW_TYPE_POPUP, rect)); 266 scoped_ptr<aura::Window> w5(CreateWindow(ui::wm::WINDOW_TYPE_POPUP, rect));
267 scoped_ptr<aura::Window> w6(CreateWindow(ui::wm::WINDOW_TYPE_CONTROL, rect)); 267 scoped_ptr<aura::Window> w6(CreateWindow(ui::wm::WINDOW_TYPE_CONTROL, rect));
268 scoped_ptr<aura::Window> w7(CreateWindow(ui::wm::WINDOW_TYPE_MENU, rect)); 268 scoped_ptr<aura::Window> w7(CreateWindow(ui::wm::WINDOW_TYPE_MENU, rect));
269 scoped_ptr<aura::Window> w8(CreateWindow(ui::wm::WINDOW_TYPE_TOOLTIP, rect)); 269 scoped_ptr<aura::Window> w8(CreateWindow(ui::wm::WINDOW_TYPE_TOOLTIP, rect));
270 EXPECT_TRUE(wm::GetWindowState(w1.get())->IsMaximized()); 270 EXPECT_TRUE(wm::GetWindowState(w1.get())->IsMaximized());
271 EXPECT_TRUE(wm::GetWindowState(w2.get())->IsMaximized()); 271 EXPECT_TRUE(wm::GetWindowState(w2.get())->IsMaximized());
272 EXPECT_EQ(3, manager->GetNumberOfManagedWindows()); 272 EXPECT_EQ(3, manager->GetNumberOfManagedWindows());
273 EXPECT_FALSE(wm::GetWindowState(w3.get())->IsMaximized()); 273 EXPECT_FALSE(wm::GetWindowState(w3.get())->IsMaximized());
274 EXPECT_NE(rect3.ToString(), w3->bounds().ToString()); 274
275 // Make sure that the position of the unresizable window is in the middle of
276 // the screen.
277 gfx::Size work_area_size =
278 ScreenUtil::GetDisplayWorkAreaBoundsInParent(w3.get()).size();
279 gfx::Point center =
280 gfx::Point((work_area_size.width() - rect3.size().width()) / 2,
281 (work_area_size.height() - rect3.size().height()) / 2);
282 gfx::Rect centered_window_bounds = gfx::Rect(center, rect3.size());
283 EXPECT_EQ(centered_window_bounds.ToString(), w3->bounds().ToString());
275 284
276 // All other windows should not have been touched. 285 // All other windows should not have been touched.
277 EXPECT_FALSE(wm::GetWindowState(w4.get())->IsMaximized()); 286 EXPECT_FALSE(wm::GetWindowState(w4.get())->IsMaximized());
278 EXPECT_FALSE(wm::GetWindowState(w5.get())->IsMaximized()); 287 EXPECT_FALSE(wm::GetWindowState(w5.get())->IsMaximized());
279 EXPECT_FALSE(wm::GetWindowState(w6.get())->IsMaximized()); 288 EXPECT_FALSE(wm::GetWindowState(w6.get())->IsMaximized());
280 EXPECT_FALSE(wm::GetWindowState(w7.get())->IsMaximized()); 289 EXPECT_FALSE(wm::GetWindowState(w7.get())->IsMaximized());
281 EXPECT_FALSE(wm::GetWindowState(w8.get())->IsMaximized()); 290 EXPECT_FALSE(wm::GetWindowState(w8.get())->IsMaximized());
282 EXPECT_EQ(rect.ToString(), w4->bounds().ToString()); 291 EXPECT_EQ(rect.ToString(), w4->bounds().ToString());
283 EXPECT_EQ(rect.ToString(), w5->bounds().ToString()); 292 EXPECT_EQ(rect.ToString(), w5->bounds().ToString());
284 EXPECT_EQ(rect.ToString(), w6->bounds().ToString()); 293 EXPECT_EQ(rect.ToString(), w6->bounds().ToString());
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 generator.MoveMouseBy(10, 5); 767 generator.MoveMouseBy(10, 5);
759 RunAllPendingInMessageLoop(); 768 RunAllPendingInMessageLoop();
760 generator.ReleaseLeftButton(); 769 generator.ReleaseLeftButton();
761 EXPECT_EQ(first_dragged_origin.x() + 10, window->bounds().x()); 770 EXPECT_EQ(first_dragged_origin.x() + 10, window->bounds().x());
762 EXPECT_EQ(first_dragged_origin.y() + 5, window->bounds().y()); 771 EXPECT_EQ(first_dragged_origin.y() + 5, window->bounds().y());
763 } 772 }
764 773
765 #endif // OS_WIN 774 #endif // OS_WIN
766 775
767 } // namespace ash 776 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/maximize_mode/maximize_mode_window_state.cc » ('j') | ash/wm/maximize_mode/maximize_mode_window_state.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698