| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
| 25 #include "ui/aura/test/event_generator.h" | 25 #include "ui/aura/test/event_generator.h" |
| 26 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
| 27 #include "ui/aura/test/test_windows.h" | 27 #include "ui/aura/test/test_windows.h" |
| 28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 29 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
| 30 #include "ui/base/ui_base_types.h" | 30 #include "ui/base/ui_base_types.h" |
| 31 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
| 32 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 32 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 33 #include "ui/gfx/screen.h" | 33 #include "ui/gfx/screen.h" |
| 34 #include "ui/views/corewm/transient_window_manager.h" |
| 34 #include "ui/views/corewm/window_animations.h" | 35 #include "ui/views/corewm/window_animations.h" |
| 35 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 36 | 37 |
| 37 using aura::Window; | 38 using aura::Window; |
| 38 | 39 |
| 39 namespace ash { | 40 namespace ash { |
| 40 namespace internal { | 41 namespace internal { |
| 41 | 42 |
| 42 // Returns a string containing the names of all the children of |window| (in | 43 // Returns a string containing the names of all the children of |window| (in |
| 43 // order). Each entry is separated by a space. | 44 // order). Each entry is separated by a space. |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 TEST_F(WorkspaceControllerTest, TransientParent) { | 670 TEST_F(WorkspaceControllerTest, TransientParent) { |
| 670 // Normal window with no transient parent. | 671 // Normal window with no transient parent. |
| 671 scoped_ptr<Window> w2(CreateTestWindow()); | 672 scoped_ptr<Window> w2(CreateTestWindow()); |
| 672 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 673 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 673 w2->Show(); | 674 w2->Show(); |
| 674 wm::ActivateWindow(w2.get()); | 675 wm::ActivateWindow(w2.get()); |
| 675 | 676 |
| 676 // Window with a transient parent. We set the transient parent to the root, | 677 // Window with a transient parent. We set the transient parent to the root, |
| 677 // which would never happen but is enough to exercise the bug. | 678 // which would never happen but is enough to exercise the bug. |
| 678 scoped_ptr<Window> w1(CreateTestWindowUnparented()); | 679 scoped_ptr<Window> w1(CreateTestWindowUnparented()); |
| 679 Shell::GetInstance()->GetPrimaryRootWindow()->AddTransientChild(w1.get()); | 680 views::corewm::AddTransientChild( |
| 681 Shell::GetInstance()->GetPrimaryRootWindow(), w1.get()); |
| 680 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); | 682 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 681 ParentWindowInPrimaryRootWindow(w1.get()); | 683 ParentWindowInPrimaryRootWindow(w1.get()); |
| 682 w1->Show(); | 684 w1->Show(); |
| 683 wm::ActivateWindow(w1.get()); | 685 wm::ActivateWindow(w1.get()); |
| 684 | 686 |
| 685 // The window with the transient parent should get added to the same parent as | 687 // The window with the transient parent should get added to the same parent as |
| 686 // the normal window. | 688 // the normal window. |
| 687 EXPECT_EQ(w2->parent(), w1->parent()); | 689 EXPECT_EQ(w2->parent(), w1->parent()); |
| 688 } | 690 } |
| 689 | 691 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 // owned by |browser|. | 1131 // owned by |browser|. |
| 1130 aura::test::TestWindowDelegate* status_bubble_delegate = | 1132 aura::test::TestWindowDelegate* status_bubble_delegate = |
| 1131 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); | 1133 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); |
| 1132 status_bubble_delegate->set_can_focus(false); | 1134 status_bubble_delegate->set_can_focus(false); |
| 1133 Window* status_bubble = | 1135 Window* status_bubble = |
| 1134 aura::test::CreateTestWindowWithDelegate( | 1136 aura::test::CreateTestWindowWithDelegate( |
| 1135 status_bubble_delegate, | 1137 status_bubble_delegate, |
| 1136 aura::client::WINDOW_TYPE_POPUP, | 1138 aura::client::WINDOW_TYPE_POPUP, |
| 1137 gfx::Rect(5, 6, 7, 8), | 1139 gfx::Rect(5, 6, 7, 8), |
| 1138 NULL); | 1140 NULL); |
| 1139 browser->AddTransientChild(status_bubble); | 1141 views::corewm::AddTransientChild(browser.get(), status_bubble); |
| 1140 ParentWindowInPrimaryRootWindow(status_bubble); | 1142 ParentWindowInPrimaryRootWindow(status_bubble); |
| 1141 status_bubble->SetName("status_bubble"); | 1143 status_bubble->SetName("status_bubble"); |
| 1142 | 1144 |
| 1143 scoped_ptr<Window> app( | 1145 scoped_ptr<Window> app( |
| 1144 aura::test::CreateTestWindowWithDelegate( | 1146 aura::test::CreateTestWindowWithDelegate( |
| 1145 NULL, | 1147 NULL, |
| 1146 aura::client::WINDOW_TYPE_NORMAL, | 1148 aura::client::WINDOW_TYPE_NORMAL, |
| 1147 gfx::Rect(5, 6, 7, 8), | 1149 gfx::Rect(5, 6, 7, 8), |
| 1148 NULL)); | 1150 NULL)); |
| 1149 app->SetName("app"); | 1151 app->SetName("app"); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 EXPECT_TRUE(GetWindowOverlapsShelf()); | 1309 EXPECT_TRUE(GetWindowOverlapsShelf()); |
| 1308 generator.ReleaseLeftButton(); | 1310 generator.ReleaseLeftButton(); |
| 1309 EXPECT_TRUE(GetWindowOverlapsShelf()); | 1311 EXPECT_TRUE(GetWindowOverlapsShelf()); |
| 1310 } | 1312 } |
| 1311 | 1313 |
| 1312 INSTANTIATE_TEST_CASE_P(DockedOrNot, WorkspaceControllerTestDragging, | 1314 INSTANTIATE_TEST_CASE_P(DockedOrNot, WorkspaceControllerTestDragging, |
| 1313 ::testing::Bool()); | 1315 ::testing::Bool()); |
| 1314 | 1316 |
| 1315 } // namespace internal | 1317 } // namespace internal |
| 1316 } // namespace ash | 1318 } // namespace ash |
| OLD | NEW |