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/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/mouse_cursor_event_filter.h" | 8 #include "ash/display/mouse_cursor_event_filter.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/screen_ash.h" | 10 #include "ash/screen_ash.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 UpdateDisplay(StringPrintf("800x%d", kRootHeight)); | 76 UpdateDisplay(StringPrintf("800x%d", kRootHeight)); |
77 | 77 |
78 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 78 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); |
79 gfx::Rect root_bounds(root->bounds()); | 79 gfx::Rect root_bounds(root->bounds()); |
80 EXPECT_EQ(kRootHeight, root_bounds.height()); | 80 EXPECT_EQ(kRootHeight, root_bounds.height()); |
81 EXPECT_EQ(800, root_bounds.width()); | 81 EXPECT_EQ(800, root_bounds.width()); |
82 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); | 82 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); |
83 window_.reset(new aura::Window(&delegate_)); | 83 window_.reset(new aura::Window(&delegate_)); |
84 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 84 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
85 window_->Init(ui::LAYER_NOT_DRAWN); | 85 window_->Init(ui::LAYER_NOT_DRAWN); |
86 window_->SetParent(NULL); | 86 SetDefaultParentByPrimaryRootWindow(window_.get()); |
87 window_->set_id(1); | 87 window_->set_id(1); |
88 | 88 |
89 window2_.reset(new aura::Window(&delegate2_)); | 89 window2_.reset(new aura::Window(&delegate2_)); |
90 window2_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 90 window2_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
91 window2_->Init(ui::LAYER_NOT_DRAWN); | 91 window2_->Init(ui::LAYER_NOT_DRAWN); |
92 window2_->SetParent(NULL); | 92 SetDefaultParentByPrimaryRootWindow(window2_.get()); |
93 window2_->set_id(2); | 93 window2_->set_id(2); |
94 | 94 |
95 window3_.reset(new aura::Window(&delegate3_)); | 95 window3_.reset(new aura::Window(&delegate3_)); |
96 window3_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 96 window3_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
97 window3_->Init(ui::LAYER_NOT_DRAWN); | 97 window3_->Init(ui::LAYER_NOT_DRAWN); |
98 window3_->SetParent(NULL); | 98 SetDefaultParentByPrimaryRootWindow(window3_.get()); |
99 window3_->set_id(3); | 99 window3_->set_id(3); |
100 | 100 |
101 window4_.reset(new aura::Window(&delegate4_)); | 101 window4_.reset(new aura::Window(&delegate4_)); |
102 window4_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 102 window4_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
103 window4_->Init(ui::LAYER_NOT_DRAWN); | 103 window4_->Init(ui::LAYER_NOT_DRAWN); |
104 window4_->SetParent(NULL); | 104 SetDefaultParentByPrimaryRootWindow(window4_.get()); |
105 window4_->set_id(4); | 105 window4_->set_id(4); |
106 } | 106 } |
107 | 107 |
108 virtual void TearDown() OVERRIDE { | 108 virtual void TearDown() OVERRIDE { |
109 window_.reset(); | 109 window_.reset(); |
110 window2_.reset(); | 110 window2_.reset(); |
111 window3_.reset(); | 111 window3_.reset(); |
112 window4_.reset(); | 112 window4_.reset(); |
113 AshTestBase::TearDown(); | 113 AshTestBase::TearDown(); |
114 } | 114 } |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 ASSERT_TRUE(resizer.get()); | 1751 ASSERT_TRUE(resizer.get()); |
1752 // Move it 50 to the left, which should contract w1 and expand w2-3. | 1752 // Move it 50 to the left, which should contract w1 and expand w2-3. |
1753 resizer->Drag(CalculateDragPoint(*resizer, -50, 0), 0); | 1753 resizer->Drag(CalculateDragPoint(*resizer, -50, 0), 0); |
1754 EXPECT_EQ("100,100 98x100", window_->bounds().ToString()); | 1754 EXPECT_EQ("100,100 98x100", window_->bounds().ToString()); |
1755 EXPECT_EQ("198,100 101x100", window2_->bounds().ToString()); | 1755 EXPECT_EQ("198,100 101x100", window2_->bounds().ToString()); |
1756 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString()); | 1756 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString()); |
1757 } | 1757 } |
1758 | 1758 |
1759 } // namespace internal | 1759 } // namespace internal |
1760 } // namespace ash | 1760 } // namespace ash |
OLD | NEW |