OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drag_window_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
6 | 6 |
7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.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/shell.h" | 10 #include "ash/shell.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); | 41 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); |
42 | 42 |
43 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 43 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); |
44 gfx::Rect root_bounds(root->bounds()); | 44 gfx::Rect root_bounds(root->bounds()); |
45 EXPECT_EQ(kRootHeight, root_bounds.height()); | 45 EXPECT_EQ(kRootHeight, root_bounds.height()); |
46 EXPECT_EQ(800, root_bounds.width()); | 46 EXPECT_EQ(800, root_bounds.width()); |
47 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); | 47 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); |
48 window_.reset(new aura::Window(&delegate_)); | 48 window_.reset(new aura::Window(&delegate_)); |
49 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 49 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
50 window_->Init(ui::LAYER_NOT_DRAWN); | 50 window_->Init(ui::LAYER_NOT_DRAWN); |
51 SetDefaultParentByPrimaryRootWindow(window_.get()); | 51 ParentWindowInPrimaryRootWindow(window_.get()); |
52 window_->set_id(1); | 52 window_->set_id(1); |
53 | 53 |
54 always_on_top_window_.reset(new aura::Window(&delegate2_)); | 54 always_on_top_window_.reset(new aura::Window(&delegate2_)); |
55 always_on_top_window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 55 always_on_top_window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
56 always_on_top_window_->SetProperty(aura::client::kAlwaysOnTopKey, true); | 56 always_on_top_window_->SetProperty(aura::client::kAlwaysOnTopKey, true); |
57 always_on_top_window_->Init(ui::LAYER_NOT_DRAWN); | 57 always_on_top_window_->Init(ui::LAYER_NOT_DRAWN); |
58 SetDefaultParentByPrimaryRootWindow(always_on_top_window_.get()); | 58 ParentWindowInPrimaryRootWindow(always_on_top_window_.get()); |
59 always_on_top_window_->set_id(2); | 59 always_on_top_window_->set_id(2); |
60 | 60 |
61 system_modal_window_.reset(new aura::Window(&delegate3_)); | 61 system_modal_window_.reset(new aura::Window(&delegate3_)); |
62 system_modal_window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 62 system_modal_window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
63 system_modal_window_->SetProperty(aura::client::kModalKey, | 63 system_modal_window_->SetProperty(aura::client::kModalKey, |
64 ui::MODAL_TYPE_SYSTEM); | 64 ui::MODAL_TYPE_SYSTEM); |
65 system_modal_window_->Init(ui::LAYER_NOT_DRAWN); | 65 system_modal_window_->Init(ui::LAYER_NOT_DRAWN); |
66 SetDefaultParentByPrimaryRootWindow(system_modal_window_.get()); | 66 ParentWindowInPrimaryRootWindow(system_modal_window_.get()); |
67 system_modal_window_->set_id(3); | 67 system_modal_window_->set_id(3); |
68 | 68 |
69 transient_child_ = new aura::Window(&delegate4_); | 69 transient_child_ = new aura::Window(&delegate4_); |
70 transient_child_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 70 transient_child_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
71 transient_child_->Init(ui::LAYER_NOT_DRAWN); | 71 transient_child_->Init(ui::LAYER_NOT_DRAWN); |
72 SetDefaultParentByPrimaryRootWindow(transient_child_); | 72 ParentWindowInPrimaryRootWindow(transient_child_); |
73 transient_child_->set_id(4); | 73 transient_child_->set_id(4); |
74 | 74 |
75 transient_parent_.reset(new aura::Window(&delegate5_)); | 75 transient_parent_.reset(new aura::Window(&delegate5_)); |
76 transient_parent_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 76 transient_parent_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
77 transient_parent_->Init(ui::LAYER_NOT_DRAWN); | 77 transient_parent_->Init(ui::LAYER_NOT_DRAWN); |
78 SetDefaultParentByPrimaryRootWindow(transient_parent_.get()); | 78 ParentWindowInPrimaryRootWindow(transient_parent_.get()); |
79 transient_parent_->AddTransientChild(transient_child_); | 79 transient_parent_->AddTransientChild(transient_child_); |
80 transient_parent_->set_id(5); | 80 transient_parent_->set_id(5); |
81 | 81 |
82 panel_window_.reset(new aura::Window(&delegate6_)); | 82 panel_window_.reset(new aura::Window(&delegate6_)); |
83 panel_window_->SetType(aura::client::WINDOW_TYPE_PANEL); | 83 panel_window_->SetType(aura::client::WINDOW_TYPE_PANEL); |
84 panel_window_->Init(ui::LAYER_NOT_DRAWN); | 84 panel_window_->Init(ui::LAYER_NOT_DRAWN); |
85 SetDefaultParentByPrimaryRootWindow(panel_window_.get()); | 85 ParentWindowInPrimaryRootWindow(panel_window_.get()); |
86 } | 86 } |
87 | 87 |
88 virtual void TearDown() OVERRIDE { | 88 virtual void TearDown() OVERRIDE { |
89 window_.reset(); | 89 window_.reset(); |
90 always_on_top_window_.reset(); | 90 always_on_top_window_.reset(); |
91 system_modal_window_.reset(); | 91 system_modal_window_.reset(); |
92 transient_parent_.reset(); | 92 transient_parent_.reset(); |
93 panel_window_.reset(); | 93 panel_window_.reset(); |
94 AshTestBase::TearDown(); | 94 AshTestBase::TearDown(); |
95 } | 95 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // The secondary display is logically on the right, but on the system (e.g. X) | 220 // The secondary display is logically on the right, but on the system (e.g. X) |
221 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. | 221 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. |
222 UpdateDisplay("800x600,800x600"); | 222 UpdateDisplay("800x600,800x600"); |
223 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 223 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
224 ASSERT_EQ(2U, root_windows.size()); | 224 ASSERT_EQ(2U, root_windows.size()); |
225 | 225 |
226 aura::test::TestWindowDelegate delegate; | 226 aura::test::TestWindowDelegate delegate; |
227 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); | 227 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); |
228 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 228 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
229 window->Init(ui::LAYER_TEXTURED); | 229 window->Init(ui::LAYER_TEXTURED); |
230 SetDefaultParentByPrimaryRootWindow(window.get()); | 230 ParentWindowInPrimaryRootWindow(window.get()); |
231 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 231 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
232 Shell::GetScreen()->GetPrimaryDisplay()); | 232 Shell::GetScreen()->GetPrimaryDisplay()); |
233 window->Show(); | 233 window->Show(); |
234 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); | 234 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); |
235 ash::wm::ActivateWindow(window.get()); | 235 ash::wm::ActivateWindow(window.get()); |
236 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 236 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
237 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 237 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
238 { | 238 { |
239 // Grab (0, 0) of the window. | 239 // Grab (0, 0) of the window. |
240 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( | 240 scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 ASSERT_TRUE(resizer.get()); | 561 ASSERT_TRUE(resizer.get()); |
562 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); | 562 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); |
563 EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0], | 563 EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0], |
564 gfx::Point(399, 200))); | 564 gfx::Point(399, 200))); |
565 resizer->CompleteDrag(0); | 565 resizer->CompleteDrag(0); |
566 } | 566 } |
567 } | 567 } |
568 | 568 |
569 } // namespace internal | 569 } // namespace internal |
570 } // namespace ash | 570 } // namespace ash |
OLD | NEW |