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

Side by Side Diff: ash/shelf/shelf_window_watcher_unittest.cc

Issue 1913473002: Makes WorkspaceWindowResizer use ash/wm/common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@root_controller_observer
Patch Set: fix exo again Created 4 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
« no previous file with comments | « ash/ash.gyp ('k') | ash/wm/aura/wm_globals_aura.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/shelf_window_watcher.h" 5 #include "ash/shelf/shelf_window_watcher.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shelf/shelf_item_types.h" 8 #include "ash/shelf/shelf_item_types.h"
9 #include "ash/shelf/shelf_model.h" 9 #include "ash/shelf/shelf_model.h"
10 #include "ash/shelf/shelf_util.h" 10 #include "ash/shelf/shelf_util.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
13 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
14 #include "ash/test/shell_test_api.h" 14 #include "ash/test/shell_test_api.h"
15 #include "ash/wm/aura/wm_window_aura.h"
15 #include "ash/wm/window_resizer.h" 16 #include "ash/wm/window_resizer.h"
16 #include "ash/wm/window_state.h" 17 #include "ash/wm/window_state.h"
17 #include "ash/wm/window_state_aura.h" 18 #include "ash/wm/window_state_aura.h"
18 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
19 #include "base/command_line.h" 20 #include "base/command_line.h"
20 #include "ui/aura/client/aura_constants.h" 21 #include "ui/aura/client/aura_constants.h"
21 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
22 #include "ui/base/hit_test.h" 23 #include "ui/base/hit_test.h"
23 24
24 namespace ash { 25 namespace ash {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 220
220 // Create a ShelfItem for |window|. 221 // Create a ShelfItem for |window|.
221 ShelfID id = CreateShelfItem(window.get()); 222 ShelfID id = CreateShelfItem(window.get());
222 EXPECT_EQ(2, model_->item_count()); 223 EXPECT_EQ(2, model_->item_count());
223 224
224 int index = model_->ItemIndexByID(id); 225 int index = model_->ItemIndexByID(id);
225 EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status); 226 EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status);
226 227
227 // Simulate dragging of |window| and check its item is not changed. 228 // Simulate dragging of |window| and check its item is not changed.
228 std::unique_ptr<WindowResizer> resizer( 229 std::unique_ptr<WindowResizer> resizer(
229 CreateWindowResizer(window.get(), gfx::Point(), HTCAPTION, 230 CreateWindowResizer(wm::WmWindowAura::Get(window.get()), gfx::Point(),
230 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 231 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE));
231 ASSERT_TRUE(resizer.get()); 232 ASSERT_TRUE(resizer.get());
232 resizer->Drag(gfx::Point(50, 50), 0); 233 resizer->Drag(gfx::Point(50, 50), 0);
233 resizer->CompleteDrag(); 234 resizer->CompleteDrag();
234 235
235 //Index and id are not changed after dragging a |window|. 236 //Index and id are not changed after dragging a |window|.
236 EXPECT_EQ(index, model_->ItemIndexByID(id)); 237 EXPECT_EQ(index, model_->ItemIndexByID(id));
237 EXPECT_EQ(id, model_->items()[index].id); 238 EXPECT_EQ(id, model_->items()[index].id);
238 } 239 }
239 240
240 // Check |window|'s item is removed when it is re-parented not to default 241 // Check |window|'s item is removed when it is re-parented not to default
(...skipping 17 matching lines...) Expand all
258 kShellWindowId_DefaultContainer); 259 kShellWindowId_DefaultContainer);
259 EXPECT_EQ(default_container, window->parent()); 260 EXPECT_EQ(default_container, window->parent());
260 261
261 aura::Window* new_parent = Shell::GetContainer( 262 aura::Window* new_parent = Shell::GetContainer(
262 root_window, 263 root_window,
263 kShellWindowId_PanelContainer); 264 kShellWindowId_PanelContainer);
264 265
265 // Simulate re-parenting to |new_parent| during the dragging. 266 // Simulate re-parenting to |new_parent| during the dragging.
266 { 267 {
267 std::unique_ptr<WindowResizer> resizer( 268 std::unique_ptr<WindowResizer> resizer(
268 CreateWindowResizer(window.get(), gfx::Point(), HTCAPTION, 269 CreateWindowResizer(wm::WmWindowAura::Get(window.get()), gfx::Point(),
269 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 270 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE));
270 ASSERT_TRUE(resizer.get()); 271 ASSERT_TRUE(resizer.get());
271 resizer->Drag(gfx::Point(50, 50), 0); 272 resizer->Drag(gfx::Point(50, 50), 0);
272 resizer->CompleteDrag(); 273 resizer->CompleteDrag();
273 EXPECT_EQ(2, model_->item_count()); 274 EXPECT_EQ(2, model_->item_count());
274 275
275 // Item should be removed when |window| is re-parented not to default 276 // Item should be removed when |window| is re-parented not to default
276 // container before fininshing the dragging. 277 // container before fininshing the dragging.
277 EXPECT_TRUE(wm::GetWindowState(window.get())->is_dragged()); 278 EXPECT_TRUE(wm::GetWindowState(window.get())->is_dragged());
278 new_parent->AddChild(window.get()); 279 new_parent->AddChild(window.get());
279 EXPECT_EQ(1, model_->item_count()); 280 EXPECT_EQ(1, model_->item_count());
280 } 281 }
281 EXPECT_FALSE(wm::GetWindowState(window.get())->is_dragged()); 282 EXPECT_FALSE(wm::GetWindowState(window.get())->is_dragged());
282 EXPECT_EQ(1, model_->item_count()); 283 EXPECT_EQ(1, model_->item_count());
283 } 284 }
284 285
285 } // namespace ash 286 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/wm/aura/wm_globals_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698