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

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

Issue 115453004: Moves management of transients out of Window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix MRUWindowTracker and MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest 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 unified diff | Download patch | Annotate | Revision Log
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/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/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_model.h" 10 #include "ash/shelf/shelf_model.h"
11 #include "ash/shelf/shelf_types.h" 11 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_util.h" 12 #include "ash/shelf/shelf_util.h"
13 #include "ash/shelf/shelf_widget.h" 13 #include "ash/shelf/shelf_widget.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 15 #include "ash/shell_window_ids.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "ash/test/cursor_manager_test_api.h" 17 #include "ash/test/cursor_manager_test_api.h"
18 #include "ash/test/shell_test_api.h" 18 #include "ash/test/shell_test_api.h"
19 #include "ash/test/test_shelf_delegate.h" 19 #include "ash/test/test_shelf_delegate.h"
20 #include "ash/wm/drag_window_resizer.h" 20 #include "ash/wm/drag_window_resizer.h"
21 #include "ash/wm/panels/panel_layout_manager.h" 21 #include "ash/wm/panels/panel_layout_manager.h"
22 #include "ash/wm/window_state.h" 22 #include "ash/wm/window_state.h"
23 #include "base/win/windows_version.h" 23 #include "base/win/windows_version.h"
24 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/root_window.h" 25 #include "ui/aura/root_window.h"
26 #include "ui/base/hit_test.h" 26 #include "ui/base/hit_test.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/ui_base_types.h" 28 #include "ui/base/ui_base_types.h"
29 #include "ui/views/corewm/transient_window_manager.h"
29 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
30 31
31 namespace ash { 32 namespace ash {
32 namespace internal { 33 namespace internal {
33 34
34 class PanelWindowResizerTest : public test::AshTestBase { 35 class PanelWindowResizerTest : public test::AshTestBase {
35 public: 36 public:
36 PanelWindowResizerTest() {} 37 PanelWindowResizerTest() {}
37 virtual ~PanelWindowResizerTest() {} 38 virtual ~PanelWindowResizerTest() {}
38 39
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 467
467 // Tests that panels can have transient children of different types. 468 // Tests that panels can have transient children of different types.
468 // The transient children should be reparented in sync with the panel. 469 // The transient children should be reparented in sync with the panel.
469 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) { 470 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) {
470 if (!SupportsHostWindowResize()) 471 if (!SupportsHostWindowResize())
471 return; 472 return;
472 473
473 scoped_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 474 scoped_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
474 scoped_ptr<aura::Window> child(CreateTestWindowInShellWithDelegateAndType( 475 scoped_ptr<aura::Window> child(CreateTestWindowInShellWithDelegateAndType(
475 NULL, transient_window_type_, 0, gfx::Rect(20, 20, 150, 40))); 476 NULL, transient_window_type_, 0, gfx::Rect(20, 20, 150, 40)));
476 window->AddTransientChild(child.get()); 477 views::corewm::AddTransientChild(window.get(), child.get());
477 if (window->parent() != child->parent()) 478 if (window->parent() != child->parent())
478 window->parent()->AddChild(child.get()); 479 window->parent()->AddChild(child.get());
479 EXPECT_EQ(window.get(), child->transient_parent()); 480 EXPECT_EQ(window.get(), views::corewm::GetTransientParent(child.get()));
480 481
481 // Drag the child to the shelf. Its new position should not be overridden. 482 // Drag the child to the shelf. Its new position should not be overridden.
482 const gfx::Rect attached_bounds(window->GetBoundsInScreen()); 483 const gfx::Rect attached_bounds(window->GetBoundsInScreen());
483 const int dy = window->GetBoundsInScreen().bottom() - 484 const int dy = window->GetBoundsInScreen().bottom() -
484 child->GetBoundsInScreen().bottom(); 485 child->GetBoundsInScreen().bottom();
485 DragStart(child.get()); 486 DragStart(child.get());
486 DragMove(50, dy); 487 DragMove(50, dy);
487 // While moving the transient child window should be in the panel container. 488 // While moving the transient child window should be in the panel container.
488 EXPECT_EQ(internal::kShellWindowId_PanelContainer, child->parent()->id()); 489 EXPECT_EQ(internal::kShellWindowId_PanelContainer, child->parent()->id());
489 DragEnd(); 490 DragEnd();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 529
529 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, 530 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest,
530 testing::Bool()); 531 testing::Bool());
531 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, PanelWindowResizerTransientTest, 532 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, PanelWindowResizerTransientTest,
532 testing::Values(aura::client::WINDOW_TYPE_NORMAL, 533 testing::Values(aura::client::WINDOW_TYPE_NORMAL,
533 aura::client::WINDOW_TYPE_PANEL, 534 aura::client::WINDOW_TYPE_PANEL,
534 aura::client::WINDOW_TYPE_POPUP)); 535 aura::client::WINDOW_TYPE_POPUP));
535 536
536 } // namespace internal 537 } // namespace internal
537 } // namespace ash 538 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698