| OLD | NEW |
| 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/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
| 8 #include "ash/public/cpp/shelf_item.h" | 8 #include "ash/public/cpp/shelf_item.h" |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/public/cpp/window_properties.h" | 10 #include "ash/public/cpp/window_properties.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); | 235 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); |
| 236 | 236 |
| 237 // Create a ShelfItem for the window. | 237 // Create a ShelfItem for the window. |
| 238 ShelfID id = CreateShelfItem(widget->GetNativeWindow()); | 238 ShelfID id = CreateShelfItem(widget->GetNativeWindow()); |
| 239 EXPECT_EQ(2, model_->item_count()); | 239 EXPECT_EQ(2, model_->item_count()); |
| 240 | 240 |
| 241 int index = model_->ItemIndexByID(id); | 241 int index = model_->ItemIndexByID(id); |
| 242 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); | 242 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); |
| 243 | 243 |
| 244 // Simulate dragging of the window and check its item is not changed. | 244 // Simulate dragging of the window and check its item is not changed. |
| 245 std::unique_ptr<WindowResizer> resizer(CreateWindowResizer( | 245 std::unique_ptr<WindowResizer> resizer( |
| 246 WmWindow::Get(widget->GetNativeWindow()), gfx::Point(), HTCAPTION, | 246 CreateWindowResizer(widget->GetNativeWindow(), gfx::Point(), HTCAPTION, |
| 247 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); | 247 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
| 248 ASSERT_TRUE(resizer.get()); | 248 ASSERT_TRUE(resizer.get()); |
| 249 resizer->Drag(gfx::Point(50, 50), 0); | 249 resizer->Drag(gfx::Point(50, 50), 0); |
| 250 resizer->CompleteDrag(); | 250 resizer->CompleteDrag(); |
| 251 | 251 |
| 252 // Index and id are not changed after dragging the window. | 252 // Index and id are not changed after dragging the window. |
| 253 EXPECT_EQ(index, model_->ItemIndexByID(id)); | 253 EXPECT_EQ(index, model_->ItemIndexByID(id)); |
| 254 EXPECT_EQ(id, model_->items()[index].id); | 254 EXPECT_EQ(id, model_->items()[index].id); |
| 255 } | 255 } |
| 256 | 256 |
| 257 // Ensure shelf items are added and removed as panels are opened and closed. | 257 // Ensure shelf items are added and removed as panels are opened and closed. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); | 345 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); |
| 346 ShelfWindowWatcherTest::CreateShelfItem(widget->GetNativeWindow()); | 346 ShelfWindowWatcherTest::CreateShelfItem(widget->GetNativeWindow()); |
| 347 EXPECT_EQ(1, model->item_count()); | 347 EXPECT_EQ(1, model->item_count()); |
| 348 | 348 |
| 349 // Start the test user session; ShelfWindowWatcher will find the open window. | 349 // Start the test user session; ShelfWindowWatcher will find the open window. |
| 350 SetSessionStarted(true); | 350 SetSessionStarted(true); |
| 351 EXPECT_EQ(2, model->item_count()); | 351 EXPECT_EQ(2, model->item_count()); |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace ash | 354 } // namespace ash |
| OLD | NEW |