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/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class WorkspaceWindowResizerTest : public test::AshTestBase { | 50 class WorkspaceWindowResizerTest : public test::AshTestBase { |
51 public: | 51 public: |
52 WorkspaceWindowResizerTest() : window_(NULL) {} | 52 WorkspaceWindowResizerTest() : window_(NULL) {} |
53 virtual ~WorkspaceWindowResizerTest() {} | 53 virtual ~WorkspaceWindowResizerTest() {} |
54 | 54 |
55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() OVERRIDE { |
56 AshTestBase::SetUp(); | 56 AshTestBase::SetUp(); |
57 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 57 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); |
58 root->SetHostSize(gfx::Size(800, kRootHeight)); | 58 root->SetHostSize(gfx::Size(800, kRootHeight)); |
59 | 59 |
60 aura::Window* default_container = | |
61 Shell::GetContainer(root, kShellWindowId_DefaultContainer); | |
62 | |
63 gfx::Rect root_bounds(root->bounds()); | 60 gfx::Rect root_bounds(root->bounds()); |
64 EXPECT_EQ(kRootHeight, root_bounds.height()); | 61 EXPECT_EQ(kRootHeight, root_bounds.height()); |
65 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); | 62 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); |
66 window_.reset(new aura::Window(&delegate_)); | 63 window_.reset(new aura::Window(&delegate_)); |
67 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 64 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
68 window_->Init(ui::LAYER_NOT_DRAWN); | 65 window_->Init(ui::LAYER_NOT_DRAWN); |
69 window_->SetParent(default_container); | 66 window_->SetParent(NULL); |
70 window_->set_id(1); | 67 window_->set_id(1); |
71 | 68 |
72 window2_.reset(new aura::Window(&delegate2_)); | 69 window2_.reset(new aura::Window(&delegate2_)); |
73 window2_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 70 window2_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
74 window2_->Init(ui::LAYER_NOT_DRAWN); | 71 window2_->Init(ui::LAYER_NOT_DRAWN); |
75 window2_->SetParent(default_container); | 72 window2_->SetParent(NULL); |
76 window2_->set_id(2); | 73 window2_->set_id(2); |
77 | 74 |
78 window3_.reset(new aura::Window(&delegate3_)); | 75 window3_.reset(new aura::Window(&delegate3_)); |
79 window3_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 76 window3_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
80 window3_->Init(ui::LAYER_NOT_DRAWN); | 77 window3_->Init(ui::LAYER_NOT_DRAWN); |
81 window3_->SetParent(default_container); | 78 window3_->SetParent(NULL); |
82 window3_->set_id(3); | 79 window3_->set_id(3); |
83 } | 80 } |
84 | 81 |
85 virtual void TearDown() OVERRIDE { | 82 virtual void TearDown() OVERRIDE { |
86 window_.reset(); | 83 window_.reset(); |
87 window2_.reset(); | 84 window2_.reset(); |
88 window3_.reset(); | 85 window3_.reset(); |
89 AshTestBase::TearDown(); | 86 AshTestBase::TearDown(); |
90 } | 87 } |
91 | 88 |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 ASSERT_TRUE(resizer.get()); | 878 ASSERT_TRUE(resizer.get()); |
882 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, | 879 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, |
883 // the window should move to the exact position. | 880 // the window should move to the exact position. |
884 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); | 881 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); |
885 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); | 882 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); |
886 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); | 883 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); |
887 } | 884 } |
888 | 885 |
889 } // namespace test | 886 } // namespace test |
890 } // namespace ash | 887 } // namespace ash |
OLD | NEW |