OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/wm/panels/panel_window_resizer.h" | 5 #include "ash/wm/panels/panel_window_resizer.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/launcher/launcher_model.h" | 8 #include "ash/launcher/launcher_model.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 private: | 214 private: |
215 bool is_rtl_; | 215 bool is_rtl_; |
216 std::string original_locale; | 216 std::string original_locale; |
217 | 217 |
218 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTextDirectionTest); | 218 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTextDirectionTest); |
219 }; | 219 }; |
220 | 220 |
221 // Verifies a window can be dragged from the panel and detached and then | 221 // Verifies a window can be dragged from the panel and detached and then |
222 // reattached. | 222 // reattached. |
223 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) { | 223 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) { |
| 224 if (!SupportsHostWindowResize()) |
| 225 return; |
| 226 |
224 scoped_ptr<aura::Window> window( | 227 scoped_ptr<aura::Window> window( |
225 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); | 228 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); |
226 DetachReattachTest(window.get(), 0, -1); | 229 DetachReattachTest(window.get(), 0, -1); |
227 } | 230 } |
228 | 231 |
229 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { | 232 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { |
| 233 if (!SupportsHostWindowResize()) |
| 234 return; |
| 235 |
230 ash::Shell* shell = ash::Shell::GetInstance(); | 236 ash::Shell* shell = ash::Shell::GetInstance(); |
231 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow()); | 237 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow()); |
232 scoped_ptr<aura::Window> window( | 238 scoped_ptr<aura::Window> window( |
233 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); | 239 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); |
234 DetachReattachTest(window.get(), 1, 0); | 240 DetachReattachTest(window.get(), 1, 0); |
235 } | 241 } |
236 | 242 |
237 #if defined(OS_WIN) | 243 #if defined(OS_WIN) |
238 // TODO(flackr): Positioning of the panel seems to be off on Windows Aura when | 244 // TODO(flackr): Positioning of the panel seems to be off on Windows Aura when |
239 // attached to the right (http://crbug.com/180892). | 245 // attached to the right (http://crbug.com/180892). |
240 #define MAYBE_PanelDetachReattachRight DISABLED_PanelDetachReattachRight | 246 #define MAYBE_PanelDetachReattachRight DISABLED_PanelDetachReattachRight |
241 #else | 247 #else |
242 #define MAYBE_PanelDetachReattachRight PanelDetachReattachRight | 248 #define MAYBE_PanelDetachReattachRight PanelDetachReattachRight |
243 #endif | 249 #endif |
244 | 250 |
245 TEST_F(PanelWindowResizerTest, MAYBE_PanelDetachReattachRight) { | 251 TEST_F(PanelWindowResizerTest, MAYBE_PanelDetachReattachRight) { |
246 ash::Shell* shell = ash::Shell::GetInstance(); | 252 ash::Shell* shell = ash::Shell::GetInstance(); |
247 shell->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT, | 253 shell->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT, |
248 shell->GetPrimaryRootWindow()); | 254 shell->GetPrimaryRootWindow()); |
249 scoped_ptr<aura::Window> window( | 255 scoped_ptr<aura::Window> window( |
250 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); | 256 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); |
251 DetachReattachTest(window.get(), -1, 0); | 257 DetachReattachTest(window.get(), -1, 0); |
252 } | 258 } |
253 | 259 |
254 TEST_F(PanelWindowResizerTest, PanelDetachReattachTop) { | 260 TEST_F(PanelWindowResizerTest, PanelDetachReattachTop) { |
| 261 if (!SupportsHostWindowResize()) |
| 262 return; |
| 263 |
255 ash::Shell* shell = ash::Shell::GetInstance(); | 264 ash::Shell* shell = ash::Shell::GetInstance(); |
256 shell->SetShelfAlignment(SHELF_ALIGNMENT_TOP, shell->GetPrimaryRootWindow()); | 265 shell->SetShelfAlignment(SHELF_ALIGNMENT_TOP, shell->GetPrimaryRootWindow()); |
257 scoped_ptr<aura::Window> window( | 266 scoped_ptr<aura::Window> window( |
258 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); | 267 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); |
259 DetachReattachTest(window.get(), 0, 1); | 268 DetachReattachTest(window.get(), 0, 1); |
260 } | 269 } |
261 | 270 |
262 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { | 271 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { |
263 if (!SupportsMultipleDisplays()) | 272 if (!SupportsMultipleDisplays()) |
264 return; | 273 return; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 DragMove(20, 0); | 434 DragMove(20, 0); |
426 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); | 435 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); |
427 DragEnd(); | 436 DragEnd(); |
428 | 437 |
429 // When dropped it should return to the default container. | 438 // When dropped it should return to the default container. |
430 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, | 439 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, |
431 window->parent()->id()); | 440 window->parent()->id()); |
432 } | 441 } |
433 | 442 |
434 TEST_P(PanelWindowResizerTextDirectionTest, DragReordersPanelsHorizontal) { | 443 TEST_P(PanelWindowResizerTextDirectionTest, DragReordersPanelsHorizontal) { |
| 444 if (!SupportsHostWindowResize()) |
| 445 return; |
| 446 |
435 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); | 447 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); |
436 } | 448 } |
437 | 449 |
438 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { | 450 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { |
439 ash::Shell* shell = ash::Shell::GetInstance(); | 451 ash::Shell* shell = ash::Shell::GetInstance(); |
440 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow()); | 452 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow()); |
441 DragAlongShelfReorder(0, -1); | 453 DragAlongShelfReorder(0, -1); |
442 } | 454 } |
443 | 455 |
444 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 456 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
445 testing::Bool()); | 457 testing::Bool()); |
446 | 458 |
447 } // namespace internal | 459 } // namespace internal |
448 } // namespace ash | 460 } // namespace ash |
OLD | NEW |