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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 AshTestBase::SetUp(); | 49 AshTestBase::SetUp(); |
50 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); | 50 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); |
51 | 51 |
52 aura::Window* root = Shell::GetPrimaryRootWindow(); | 52 aura::Window* root = Shell::GetPrimaryRootWindow(); |
53 gfx::Rect root_bounds(root->bounds()); | 53 gfx::Rect root_bounds(root->bounds()); |
54 EXPECT_EQ(kRootHeight, root_bounds.height()); | 54 EXPECT_EQ(kRootHeight, root_bounds.height()); |
55 EXPECT_EQ(800, root_bounds.width()); | 55 EXPECT_EQ(800, root_bounds.width()); |
56 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); | 56 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); |
57 window_.reset(new aura::Window(&delegate_)); | 57 window_.reset(new aura::Window(&delegate_)); |
58 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 58 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
59 window_->Init(ui::LAYER_NOT_DRAWN); | 59 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
60 ParentWindowInPrimaryRootWindow(window_.get()); | 60 ParentWindowInPrimaryRootWindow(window_.get()); |
61 window_->set_id(1); | 61 window_->set_id(1); |
62 | 62 |
63 always_on_top_window_.reset(new aura::Window(&delegate2_)); | 63 always_on_top_window_.reset(new aura::Window(&delegate2_)); |
64 always_on_top_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 64 always_on_top_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
65 always_on_top_window_->SetProperty(aura::client::kAlwaysOnTopKey, true); | 65 always_on_top_window_->SetProperty(aura::client::kAlwaysOnTopKey, true); |
66 always_on_top_window_->Init(ui::LAYER_NOT_DRAWN); | 66 always_on_top_window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
67 ParentWindowInPrimaryRootWindow(always_on_top_window_.get()); | 67 ParentWindowInPrimaryRootWindow(always_on_top_window_.get()); |
68 always_on_top_window_->set_id(2); | 68 always_on_top_window_->set_id(2); |
69 | 69 |
70 system_modal_window_.reset(new aura::Window(&delegate3_)); | 70 system_modal_window_.reset(new aura::Window(&delegate3_)); |
71 system_modal_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 71 system_modal_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
72 system_modal_window_->SetProperty(aura::client::kModalKey, | 72 system_modal_window_->SetProperty(aura::client::kModalKey, |
73 ui::MODAL_TYPE_SYSTEM); | 73 ui::MODAL_TYPE_SYSTEM); |
74 system_modal_window_->Init(ui::LAYER_NOT_DRAWN); | 74 system_modal_window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
75 ParentWindowInPrimaryRootWindow(system_modal_window_.get()); | 75 ParentWindowInPrimaryRootWindow(system_modal_window_.get()); |
76 system_modal_window_->set_id(3); | 76 system_modal_window_->set_id(3); |
77 | 77 |
78 transient_child_ = new aura::Window(&delegate4_); | 78 transient_child_ = new aura::Window(&delegate4_); |
79 transient_child_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 79 transient_child_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
80 transient_child_->Init(ui::LAYER_NOT_DRAWN); | 80 transient_child_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
81 ParentWindowInPrimaryRootWindow(transient_child_); | 81 ParentWindowInPrimaryRootWindow(transient_child_); |
82 transient_child_->set_id(4); | 82 transient_child_->set_id(4); |
83 | 83 |
84 transient_parent_.reset(new aura::Window(&delegate5_)); | 84 transient_parent_.reset(new aura::Window(&delegate5_)); |
85 transient_parent_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 85 transient_parent_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
86 transient_parent_->Init(ui::LAYER_NOT_DRAWN); | 86 transient_parent_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
87 ParentWindowInPrimaryRootWindow(transient_parent_.get()); | 87 ParentWindowInPrimaryRootWindow(transient_parent_.get()); |
88 views::corewm::AddTransientChild(transient_parent_.get(), transient_child_); | 88 views::corewm::AddTransientChild(transient_parent_.get(), transient_child_); |
89 transient_parent_->set_id(5); | 89 transient_parent_->set_id(5); |
90 | 90 |
91 panel_window_.reset(new aura::Window(&delegate6_)); | 91 panel_window_.reset(new aura::Window(&delegate6_)); |
92 panel_window_->SetType(ui::wm::WINDOW_TYPE_PANEL); | 92 panel_window_->SetType(ui::wm::WINDOW_TYPE_PANEL); |
93 panel_window_->Init(ui::LAYER_NOT_DRAWN); | 93 panel_window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
94 ParentWindowInPrimaryRootWindow(panel_window_.get()); | 94 ParentWindowInPrimaryRootWindow(panel_window_.get()); |
95 } | 95 } |
96 | 96 |
97 virtual void TearDown() OVERRIDE { | 97 virtual void TearDown() OVERRIDE { |
98 window_.reset(); | 98 window_.reset(); |
99 always_on_top_window_.reset(); | 99 always_on_top_window_.reset(); |
100 system_modal_window_.reset(); | 100 system_modal_window_.reset(); |
101 transient_parent_.reset(); | 101 transient_parent_.reset(); |
102 panel_window_.reset(); | 102 panel_window_.reset(); |
103 AshTestBase::TearDown(); | 103 AshTestBase::TearDown(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 // The secondary display is logically on the right, but on the system (e.g. X) | 288 // The secondary display is logically on the right, but on the system (e.g. X) |
289 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. | 289 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. |
290 UpdateDisplay("800x600,800x600"); | 290 UpdateDisplay("800x600,800x600"); |
291 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 291 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
292 ASSERT_EQ(2U, root_windows.size()); | 292 ASSERT_EQ(2U, root_windows.size()); |
293 | 293 |
294 aura::test::TestWindowDelegate delegate; | 294 aura::test::TestWindowDelegate delegate; |
295 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); | 295 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); |
296 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 296 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
297 window->Init(ui::LAYER_TEXTURED); | 297 window->Init(aura::WINDOW_LAYER_TEXTURED); |
298 ParentWindowInPrimaryRootWindow(window.get()); | 298 ParentWindowInPrimaryRootWindow(window.get()); |
299 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 299 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
300 Shell::GetScreen()->GetPrimaryDisplay()); | 300 Shell::GetScreen()->GetPrimaryDisplay()); |
301 window->Show(); | 301 window->Show(); |
302 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); | 302 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); |
303 ash::wm::ActivateWindow(window.get()); | 303 ash::wm::ActivateWindow(window.get()); |
304 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 304 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
305 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 305 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
306 { | 306 { |
307 // Grab (0, 0) of the window. | 307 // Grab (0, 0) of the window. |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 resizer->CompleteDrag(); | 719 resizer->CompleteDrag(); |
720 EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls()); | 720 EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls()); |
721 EXPECT_NE(initial_bounds.ToString(), window->bounds().ToString()); | 721 EXPECT_NE(initial_bounds.ToString(), window->bounds().ToString()); |
722 } | 722 } |
723 } | 723 } |
724 #endif | 724 #endif |
725 | 725 |
726 | 726 |
727 } // namespace internal | 727 } // namespace internal |
728 } // namespace ash | 728 } // namespace ash |
OLD | NEW |