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

Unified Diff: ash/shelf/shelf_window_watcher_unittest.cc

Issue 108313006: [ash] Don't remove an item when associated window is dragged (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« ash/shelf/shelf_window_watcher.cc ('K') | « ash/shelf/shelf_window_watcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« ash/shelf/shelf_window_watcher.cc ('K') | « ash/shelf/shelf_window_watcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698