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

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

Issue 2542493002: Replace kCanMaximize/Minimize/Resize with kResizeBehavior. (Closed)
Patch Set: Fix int->bool compile issue. Created 4 years 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/common/wm/maximize_mode/maximize_mode_window_manager.h" 5 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
12 #include "ash/common/wm/mru_window_tracker.h" 12 #include "ash/common/wm/mru_window_tracker.h"
13 #include "ash/common/wm/overview/window_selector_controller.h" 13 #include "ash/common/wm/overview/window_selector_controller.h"
14 #include "ash/common/wm/switchable_windows.h" 14 #include "ash/common/wm/switchable_windows.h"
15 #include "ash/common/wm/window_state.h" 15 #include "ash/common/wm/window_state.h"
16 #include "ash/common/wm/window_state_observer.h" 16 #include "ash/common/wm/window_state_observer.h"
17 #include "ash/common/wm/wm_event.h" 17 #include "ash/common/wm/wm_event.h"
18 #include "ash/common/wm_shell.h" 18 #include "ash/common/wm_shell.h"
19 #include "ash/root_window_controller.h" 19 #include "ash/root_window_controller.h"
20 #include "ash/screen_util.h" 20 #include "ash/screen_util.h"
21 #include "ash/shell.h" 21 #include "ash/shell.h"
22 #include "ash/test/ash_test_base.h" 22 #include "ash/test/ash_test_base.h"
23 #include "ash/test/shell_test_api.h" 23 #include "ash/test/shell_test_api.h"
24 #include "ash/wm/window_properties.h" 24 #include "ash/wm/window_properties.h"
25 #include "ash/wm/window_state_aura.h" 25 #include "ash/wm/window_state_aura.h"
26 #include "ash/wm/window_util.h" 26 #include "ash/wm/window_util.h"
27 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
28 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "base/values.h" 29 #include "base/values.h"
30 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
30 #include "ui/aura/client/aura_constants.h" 31 #include "ui/aura/client/aura_constants.h"
31 #include "ui/aura/test/test_window_delegate.h" 32 #include "ui/aura/test/test_window_delegate.h"
32 #include "ui/aura/test/test_windows.h" 33 #include "ui/aura/test/test_windows.h"
33 #include "ui/aura/window.h" 34 #include "ui/aura/window.h"
34 #include "ui/base/hit_test.h" 35 #include "ui/base/hit_test.h"
35 #include "ui/events/test/event_generator.h" 36 #include "ui/events/test/event_generator.h"
36 #include "ui/views/widget/widget.h" 37 #include "ui/views/widget/widget.h"
37 38
38 namespace ash { 39 namespace ash {
39 40
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool can_resize) { 124 bool can_resize) {
124 aura::test::TestWindowDelegate* delegate = NULL; 125 aura::test::TestWindowDelegate* delegate = NULL;
125 if (!can_maximize) { 126 if (!can_maximize) {
126 delegate = aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); 127 delegate = aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate();
127 delegate->set_window_component(HTCAPTION); 128 delegate->set_window_component(HTCAPTION);
128 if (!max_size.IsEmpty()) 129 if (!max_size.IsEmpty())
129 delegate->set_maximum_size(max_size); 130 delegate->set_maximum_size(max_size);
130 } 131 }
131 aura::Window* window = aura::test::CreateTestWindowWithDelegateAndType( 132 aura::Window* window = aura::test::CreateTestWindowWithDelegateAndType(
132 delegate, type, 0, bounds, NULL); 133 delegate, type, 0, bounds, NULL);
133 window->SetProperty(aura::client::kCanMaximizeKey, can_maximize); 134 int32_t behavior = ui::mojom::kResizeBehaviorNone;
134 if (!can_resize) 135 behavior |= can_resize ? ui::mojom::kResizeBehaviorCanResize : 0;
135 window->SetProperty(aura::client::kCanResizeKey, false); 136 behavior |= can_maximize ? ui::mojom::kResizeBehaviorCanMaximize : 0;
137 window->SetProperty(aura::client::kResizeBehaviorKey, behavior);
136 aura::Window* container = Shell::GetContainer( 138 aura::Window* container = Shell::GetContainer(
137 Shell::GetPrimaryRootWindow(), wm::kSwitchableWindowContainerIds[0]); 139 Shell::GetPrimaryRootWindow(), wm::kSwitchableWindowContainerIds[0]);
138 container->AddChild(window); 140 container->AddChild(window);
139 return window; 141 return window;
140 } 142 }
141 143
142 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManagerTest); 144 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowManagerTest);
143 }; 145 };
144 146
145 // Test that creating the object and destroying it without any windows should 147 // Test that creating the object and destroying it without any windows should
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 EXPECT_EQ(1, observer.GetPostCountAndReset()); 1696 EXPECT_EQ(1, observer.GetPostCountAndReset());
1695 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, 1697 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED,
1696 observer.GetLastOldStateAndReset()); 1698 observer.GetLastOldStateAndReset());
1697 1699
1698 window_state->RemoveObserver(&observer); 1700 window_state->RemoveObserver(&observer);
1699 1701
1700 DestroyMaximizeModeWindowManager(); 1702 DestroyMaximizeModeWindowManager();
1701 } 1703 }
1702 1704
1703 } // namespace ash 1705 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_layout_manager_unittest.cc ('k') | ash/wm/toplevel_window_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698