OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/wm/public/window_manager.h" | 5 #include "athena/wm/public/window_manager.h" |
6 | 6 |
7 #include "athena/test/athena_test_base.h" | 7 #include "athena/test/athena_test_base.h" |
8 #include "athena/wm/public/window_list_provider.h" | 8 #include "athena/wm/public/window_list_provider.h" |
9 #include "athena/wm/split_view_controller.h" | 9 #include "athena/wm/split_view_controller.h" |
10 #include "athena/wm/window_manager_impl.h" | 10 #include "athena/wm/window_manager_impl.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 // Swipe the title of the right window now. It should switch to |third|. | 213 // Swipe the title of the right window now. It should switch to |third|. |
214 generator.GestureScrollSequence(gfx::Point(x_middle + 20, 10), | 214 generator.GestureScrollSequence(gfx::Point(x_middle + 20, 10), |
215 gfx::Point(x_middle + 20, 400), | 215 gfx::Point(x_middle + 20, 400), |
216 base::TimeDelta::FromMilliseconds(20), | 216 base::TimeDelta::FromMilliseconds(20), |
217 5); | 217 5); |
218 EXPECT_EQ(second.get(), wm_api.split_view_controller()->left_window()); | 218 EXPECT_EQ(second.get(), wm_api.split_view_controller()->left_window()); |
219 EXPECT_EQ(third.get(), wm_api.split_view_controller()->right_window()); | 219 EXPECT_EQ(third.get(), wm_api.split_view_controller()->right_window()); |
220 } | 220 } |
221 | 221 |
| 222 TEST_F(WindowManagerTest, NewWindowBounds) { |
| 223 aura::test::TestWindowDelegate delegate; |
| 224 scoped_ptr<aura::Window> first(CreateWindow(&delegate)); |
| 225 |
| 226 WindowManagerImplTestApi wm_api; |
| 227 wm_api.container()->AddChild(first.get()); |
| 228 // The window should have the same size as the container. |
| 229 EXPECT_EQ(wm_api.container()->bounds().size().ToString(), |
| 230 first->bounds().size().ToString()); |
| 231 EXPECT_TRUE(first->bounds().origin().IsOrigin()); |
| 232 |
| 233 // A second window should have the same bounds as the first one. |
| 234 scoped_ptr<aura::Window> second(CreateWindow(&delegate)); |
| 235 wm_api.container()->AddChild(second.get()); |
| 236 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); |
| 237 |
| 238 // Get into split view. |
| 239 wm_api.split_view_controller()->ActivateSplitMode(NULL, NULL); |
| 240 const gfx::Rect left_bounds = |
| 241 wm_api.split_view_controller()->left_window()->bounds(); |
| 242 EXPECT_NE(wm_api.container()->bounds().size().ToString(), |
| 243 left_bounds.size().ToString()); |
| 244 |
| 245 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); |
| 246 wm_api.container()->AddChild(third.get()); |
| 247 EXPECT_NE(wm_api.split_view_controller()->left_window(), third.get()); |
| 248 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); |
| 249 |
| 250 third->Hide(); |
| 251 EXPECT_EQ( |
| 252 left_bounds.ToString(), |
| 253 instance->split_view_controller()->left_window()->bounds().ToString()); |
| 254 } |
| 255 |
222 } // namespace athena | 256 } // namespace athena |
OLD | NEW |