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

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

Issue 557693002: [Ash] Only snap windows that can maximize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up other tests. Created 6 years, 3 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
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 <string> 7 #include <string>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Create a window in one of the containers which are watched by the 112 // Create a window in one of the containers which are watched by the
113 // MaximizeModeWindowManager. Note that this only works with one root window. 113 // MaximizeModeWindowManager. Note that this only works with one root window.
114 // If |can_maximize| is not set, |max_size| is the upper limiting size for 114 // If |can_maximize| is not set, |max_size| is the upper limiting size for
115 // the window, whereas an empty size means that there is no limit. 115 // the window, whereas an empty size means that there is no limit.
116 aura::Window* CreateWindowInWatchedContainer(ui::wm::WindowType type, 116 aura::Window* CreateWindowInWatchedContainer(ui::wm::WindowType type,
117 const gfx::Rect& bounds, 117 const gfx::Rect& bounds,
118 const gfx::Size& max_size, 118 const gfx::Size& max_size,
119 bool can_maximize, 119 bool can_maximize,
120 bool can_resize) { 120 bool can_resize) {
121 aura::test::TestWindowDelegate* delegate = NULL; 121 aura::test::TestWindowDelegate* delegate = NULL;
122 if (!can_maximize) { 122 delegate = aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate();
123 delegate = aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); 123 delegate->set_window_component(HTCAPTION);
124 delegate->set_window_component(HTCAPTION); 124 delegate->set_maximum_size(max_size);
125 if (!max_size.IsEmpty())
126 delegate->set_maximum_size(max_size);
127 }
128 aura::Window* window = aura::test::CreateTestWindowWithDelegateAndType( 125 aura::Window* window = aura::test::CreateTestWindowWithDelegateAndType(
129 delegate, type, 0, bounds, NULL); 126 delegate, type, 0, bounds, NULL);
130 window->SetProperty(aura::client::kCanMaximizeKey, can_maximize); 127 window->SetProperty(aura::client::kCanMaximizeKey, can_maximize);
131 if (!can_resize) 128 if (!can_resize)
132 window->SetProperty(aura::client::kCanResizeKey, false); 129 window->SetProperty(aura::client::kCanResizeKey, false);
133 aura::Window* container = Shell::GetContainer( 130 aura::Window* container = Shell::GetContainer(
134 Shell::GetPrimaryRootWindow(), 131 Shell::GetPrimaryRootWindow(),
135 kSwitchableWindowContainerIds[0]); 132 kSwitchableWindowContainerIds[0]);
136 container->AddChild(window); 133 container->AddChild(window);
137 return window; 134 return window;
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 // The window should still be full screen and immersive. 1223 // The window should still be full screen and immersive.
1227 EXPECT_TRUE(window_state->IsFullscreen()); 1224 EXPECT_TRUE(window_state->IsFullscreen());
1228 EXPECT_TRUE(window_state->in_immersive_fullscreen()); 1225 EXPECT_TRUE(window_state->in_immersive_fullscreen());
1229 1226
1230 DestroyMaximizeModeWindowManager(); 1227 DestroyMaximizeModeWindowManager();
1231 } 1228 }
1232 1229
1233 #endif // OS_WIN 1230 #endif // OS_WIN
1234 1231
1235 } // namespace ash 1232 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698