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

Side by Side Diff: ash/wm/panels/panel_window_resizer_unittest.cc

Issue 2370913002: Removes AshTestBase::SupportsHostWindowResize (Closed)
Patch Set: feedback Created 4 years, 2 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
« no previous file with comments | « ash/wm/overview/window_selector_unittest.cc ('k') | ash/wm/window_positioner_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/wm/panels/panel_window_resizer.h" 5 #include "ash/common/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shelf/shelf_layout_manager.h" 8 #include "ash/common/shelf/shelf_layout_manager.h"
9 #include "ash/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 protected: 221 protected:
222 ui::wm::WindowType transient_window_type_; 222 ui::wm::WindowType transient_window_type_;
223 223
224 private: 224 private:
225 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTransientTest); 225 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTransientTest);
226 }; 226 };
227 227
228 // Verifies a window can be dragged from the panel and detached and then 228 // Verifies a window can be dragged from the panel and detached and then
229 // reattached. 229 // reattached.
230 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) { 230 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) {
231 if (!SupportsHostWindowResize())
232 return;
233
234 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 231 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
235 DetachReattachTest(window.get(), 0, -1); 232 DetachReattachTest(window.get(), 0, -1);
236 } 233 }
237 234
238 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { 235 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) {
239 if (!SupportsHostWindowResize())
240 return;
241
242 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); 236 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
243 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 237 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
244 DetachReattachTest(window.get(), 1, 0); 238 DetachReattachTest(window.get(), 1, 0);
245 } 239 }
246 240
247 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) { 241 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) {
248 if (!SupportsHostWindowResize())
249 return;
250
251 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_RIGHT); 242 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_RIGHT);
252 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 243 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
253 DetachReattachTest(window.get(), -1, 0); 244 DetachReattachTest(window.get(), -1, 0);
254 } 245 }
255 246
256 // Tests that a drag continues when the shelf is hidden. This occurs as part of 247 // Tests that a drag continues when the shelf is hidden. This occurs as part of
257 // the animation when switching profiles. http://crbug.com/393047. 248 // the animation when switching profiles. http://crbug.com/393047.
258 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) { 249 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) {
259 if (!SupportsHostWindowResize())
260 return;
261 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 250 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
262 wm::WindowState* state = wm::GetWindowState(window.get()); 251 wm::WindowState* state = wm::GetWindowState(window.get());
263 gfx::Rect expected_bounds = window->GetBoundsInScreen(); 252 gfx::Rect expected_bounds = window->GetBoundsInScreen();
264 expected_bounds.set_y(expected_bounds.y() - 100); 253 expected_bounds.set_y(expected_bounds.y() - 100);
265 DragStart(window.get()); 254 DragStart(window.get());
266 DragMove(0, -100); 255 DragMove(0, -100);
267 EXPECT_FALSE(state->IsMinimized()); 256 EXPECT_FALSE(state->IsMinimized());
268 257
269 // Hide the shelf. This minimizes all attached windows but should ignore 258 // Hide the shelf. This minimizes all attached windows but should ignore
270 // the dragged window. 259 // the dragged window.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 DragStart(window.get()); 459 DragStart(window.get());
471 DragMove(20, 0); 460 DragMove(20, 0);
472 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); 461 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
473 DragEnd(); 462 DragEnd();
474 463
475 // When dropped it should return to the default container. 464 // When dropped it should return to the default container.
476 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); 465 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
477 } 466 }
478 467
479 TEST_P(PanelWindowResizerTextDirectionTest, DragReordersPanelsHorizontal) { 468 TEST_P(PanelWindowResizerTextDirectionTest, DragReordersPanelsHorizontal) {
480 if (!SupportsHostWindowResize())
481 return;
482
483 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); 469 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0);
484 } 470 }
485 471
486 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { 472 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) {
487 if (!SupportsHostWindowResize())
488 return;
489
490 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); 473 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
491 DragAlongShelfReorder(0, -1); 474 DragAlongShelfReorder(0, -1);
492 } 475 }
493 476
494 // Tests that panels can have transient children of different types. 477 // Tests that panels can have transient children of different types.
495 // The transient children should be reparented in sync with the panel. 478 // The transient children should be reparented in sync with the panel.
496 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) { 479 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) {
497 if (!SupportsHostWindowResize())
498 return;
499
500 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 480 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
501 std::unique_ptr<aura::Window> child( 481 std::unique_ptr<aura::Window> child(
502 CreateTestWindowInShellWithDelegateAndType( 482 CreateTestWindowInShellWithDelegateAndType(
503 NULL, transient_window_type_, 0, gfx::Rect(20, 20, 150, 40))); 483 NULL, transient_window_type_, 0, gfx::Rect(20, 20, 150, 40)));
504 ::wm::AddTransientChild(window.get(), child.get()); 484 ::wm::AddTransientChild(window.get(), child.get());
505 if (window->parent() != child->parent()) 485 if (window->parent() != child->parent())
506 window->parent()->AddChild(child.get()); 486 window->parent()->AddChild(child.get());
507 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get())); 487 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get()));
508 488
509 // Drag the child to the shelf. Its new position should not be overridden. 489 // Drag the child to the shelf. Its new position should not be overridden.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 INSTANTIATE_TEST_CASE_P(LtrRtl, 537 INSTANTIATE_TEST_CASE_P(LtrRtl,
558 PanelWindowResizerTextDirectionTest, 538 PanelWindowResizerTextDirectionTest,
559 testing::Bool()); 539 testing::Bool());
560 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, 540 INSTANTIATE_TEST_CASE_P(NormalPanelPopup,
561 PanelWindowResizerTransientTest, 541 PanelWindowResizerTransientTest,
562 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 542 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
563 ui::wm::WINDOW_TYPE_PANEL, 543 ui::wm::WINDOW_TYPE_PANEL,
564 ui::wm::WINDOW_TYPE_POPUP)); 544 ui::wm::WINDOW_TYPE_POPUP));
565 545
566 } // namespace ash 546 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_unittest.cc ('k') | ash/wm/window_positioner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698