Index: ash/shelf/shelf_window_watcher_unittest.cc |
diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc |
index 1217aae2e5ecb048efa0850646722c290b2d25a9..899c19cdcde7a69d8c0f370282d83805a959ffa5 100644 |
--- a/ash/shelf/shelf_window_watcher_unittest.cc |
+++ b/ash/shelf/shelf_window_watcher_unittest.cc |
@@ -10,10 +10,12 @@ |
#include "ash/shell.h" |
#include "ash/test/ash_test_base.h" |
#include "ash/test/shell_test_api.h" |
+#include "ash/wm/window_resizer.h" |
#include "ash/wm/window_state.h" |
#include "ash/wm/window_util.h" |
#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/window.h" |
+#include "ui/base/hit_test.h" |
namespace ash { |
namespace internal { |
@@ -166,7 +168,35 @@ TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) { |
EXPECT_FALSE(window_state->IsMaximized()); |
// No new item is created after restoring a window |window|. |
EXPECT_EQ(2, model_->item_count()); |
- // index and id are not changed after maximizing a window |window|. |
+ // Index and id are not changed after maximizing a window |window|. |
+ EXPECT_EQ(index, model_->ItemIndexByID(id)); |
+ EXPECT_EQ(id, model_->items()[index].id); |
+} |
+ |
+TEST_F(ShelfWindowWatcherTest, DragWindow) { |
+ // ShelfModel only has an APP_LIST item. |
+ EXPECT_EQ(1, model_->item_count()); |
+ |
+ scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
+ |
+ // Create a LauncherItem for |window|. |
+ LauncherID id = CreateLauncherItem(window.get()); |
+ EXPECT_EQ(2, model_->item_count()); |
+ |
+ int index = model_->ItemIndexByID(id); |
+ EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status); |
+ |
+ // Simulate dragging of |window|. |
+ scoped_ptr<WindowResizer> resizer( |
+ CreateWindowResizer(window.get(), |
+ gfx::Point(), |
+ HTCAPTION, |
+ aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
+ ASSERT_TRUE(resizer.get()); |
+ resizer->Drag(gfx::Point(50, 50), 0); |
+ resizer->CompleteDrag(0); |
+ |
+ //Index and id are not changed after dragging a |window|. |
EXPECT_EQ(index, model_->ItemIndexByID(id)); |
EXPECT_EQ(id, model_->items()[index].id); |
} |