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

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

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 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 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/aura/wm_window_aura.h"
8 #include "ash/common/shell_window_ids.h" 9 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/wm/window_resizer.h" 10 #include "ash/common/wm/window_resizer.h"
10 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
11 #include "ash/shelf/shelf_item_types.h" 12 #include "ash/shelf/shelf_item_types.h"
12 #include "ash/shelf/shelf_model.h" 13 #include "ash/shelf/shelf_model.h"
13 #include "ash/shelf/shelf_util.h" 14 #include "ash/shelf/shelf_util.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
16 #include "ash/test/shell_test_api.h" 17 #include "ash/test/shell_test_api.h"
17 #include "ash/wm/aura/wm_window_aura.h"
18 #include "ash/wm/window_state_aura.h" 18 #include "ash/wm/window_state_aura.h"
19 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "ui/aura/client/aura_constants.h" 21 #include "ui/aura/client/aura_constants.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/base/hit_test.h" 23 #include "ui/base/hit_test.h"
24 24
25 namespace ash { 25 namespace ash {
26 26
27 class ShelfWindowWatcherTest : public test::AshTestBase { 27 class ShelfWindowWatcherTest : public test::AshTestBase {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 // Create a ShelfItem for |window|. 221 // Create a ShelfItem for |window|.
222 ShelfID id = CreateShelfItem(window.get()); 222 ShelfID id = CreateShelfItem(window.get());
223 EXPECT_EQ(2, model_->item_count()); 223 EXPECT_EQ(2, model_->item_count());
224 224
225 int index = model_->ItemIndexByID(id); 225 int index = model_->ItemIndexByID(id);
226 EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status); 226 EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status);
227 227
228 // Simulate dragging of |window| and check its item is not changed. 228 // Simulate dragging of |window| and check its item is not changed.
229 std::unique_ptr<WindowResizer> resizer( 229 std::unique_ptr<WindowResizer> resizer(
230 CreateWindowResizer(wm::WmWindowAura::Get(window.get()), gfx::Point(), 230 CreateWindowResizer(WmWindowAura::Get(window.get()), gfx::Point(),
231 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 231 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE));
232 ASSERT_TRUE(resizer.get()); 232 ASSERT_TRUE(resizer.get());
233 resizer->Drag(gfx::Point(50, 50), 0); 233 resizer->Drag(gfx::Point(50, 50), 0);
234 resizer->CompleteDrag(); 234 resizer->CompleteDrag();
235 235
236 //Index and id are not changed after dragging a |window|. 236 //Index and id are not changed after dragging a |window|.
237 EXPECT_EQ(index, model_->ItemIndexByID(id)); 237 EXPECT_EQ(index, model_->ItemIndexByID(id));
238 EXPECT_EQ(id, model_->items()[index].id); 238 EXPECT_EQ(id, model_->items()[index].id);
239 } 239 }
240 240
(...skipping 18 matching lines...) Expand all
259 kShellWindowId_DefaultContainer); 259 kShellWindowId_DefaultContainer);
260 EXPECT_EQ(default_container, window->parent()); 260 EXPECT_EQ(default_container, window->parent());
261 261
262 aura::Window* new_parent = Shell::GetContainer( 262 aura::Window* new_parent = Shell::GetContainer(
263 root_window, 263 root_window,
264 kShellWindowId_PanelContainer); 264 kShellWindowId_PanelContainer);
265 265
266 // Simulate re-parenting to |new_parent| during the dragging. 266 // Simulate re-parenting to |new_parent| during the dragging.
267 { 267 {
268 std::unique_ptr<WindowResizer> resizer( 268 std::unique_ptr<WindowResizer> resizer(
269 CreateWindowResizer(wm::WmWindowAura::Get(window.get()), gfx::Point(), 269 CreateWindowResizer(WmWindowAura::Get(window.get()), gfx::Point(),
270 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 270 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE));
271 ASSERT_TRUE(resizer.get()); 271 ASSERT_TRUE(resizer.get());
272 resizer->Drag(gfx::Point(50, 50), 0); 272 resizer->Drag(gfx::Point(50, 50), 0);
273 resizer->CompleteDrag(); 273 resizer->CompleteDrag();
274 EXPECT_EQ(2, model_->item_count()); 274 EXPECT_EQ(2, model_->item_count());
275 275
276 // 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
277 // container before fininshing the dragging. 277 // container before fininshing the dragging.
278 EXPECT_TRUE(wm::GetWindowState(window.get())->is_dragged()); 278 EXPECT_TRUE(wm::GetWindowState(window.get())->is_dragged());
279 new_parent->AddChild(window.get()); 279 new_parent->AddChild(window.get());
280 EXPECT_EQ(1, model_->item_count()); 280 EXPECT_EQ(1, model_->item_count());
281 } 281 }
282 EXPECT_FALSE(wm::GetWindowState(window.get())->is_dragged()); 282 EXPECT_FALSE(wm::GetWindowState(window.get())->is_dragged());
283 EXPECT_EQ(1, model_->item_count()); 283 EXPECT_EQ(1, model_->item_count());
284 } 284 }
285 285
286 } // namespace ash 286 } // namespace ash
OLDNEW
« ash/common/wm_window.h ('K') | « ash/shelf/shelf_widget.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698