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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 // Swipe the title of the right window now. It should switch to |third|. | 229 // Swipe the title of the right window now. It should switch to |third|. |
230 generator.GestureScrollSequence(gfx::Point(x_middle + 20, 10), | 230 generator.GestureScrollSequence(gfx::Point(x_middle + 20, 10), |
231 gfx::Point(x_middle + 20, 400), | 231 gfx::Point(x_middle + 20, 400), |
232 base::TimeDelta::FromMilliseconds(20), | 232 base::TimeDelta::FromMilliseconds(20), |
233 5); | 233 5); |
234 EXPECT_EQ(second.get(), wm_api.split_view_controller()->left_window()); | 234 EXPECT_EQ(second.get(), wm_api.split_view_controller()->left_window()); |
235 EXPECT_EQ(third.get(), wm_api.split_view_controller()->right_window()); | 235 EXPECT_EQ(third.get(), wm_api.split_view_controller()->right_window()); |
236 } | 236 } |
237 | 237 |
| 238 TEST_F(WindowManagerTest, NewWindowBounds) { |
| 239 aura::test::TestWindowDelegate delegate; |
| 240 scoped_ptr<aura::Window> first(CreateWindow(&delegate)); |
| 241 |
| 242 WindowManagerImplTestApi wm_api; |
| 243 aura::client::ParentWindowWithContext( |
| 244 first.get(), wm_api.container(), gfx::Rect()); |
| 245 // The window should have the same size as the container. |
| 246 EXPECT_EQ(wm_api.container()->bounds().size().ToString(), |
| 247 first->bounds().size().ToString()); |
| 248 EXPECT_TRUE(first->bounds().origin().IsOrigin()); |
| 249 |
| 250 // A second window should have the same bounds as the first one. |
| 251 scoped_ptr<aura::Window> second(CreateWindow(&delegate)); |
| 252 aura::client::ParentWindowWithContext( |
| 253 second.get(), wm_api.container(), gfx::Rect()); |
| 254 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); |
| 255 |
| 256 // Get into split view. |
| 257 wm_api.split_view_controller()->ActivateSplitMode(NULL, NULL); |
| 258 const gfx::Rect left_bounds = |
| 259 wm_api.split_view_controller()->left_window()->bounds(); |
| 260 EXPECT_NE(wm_api.container()->bounds().size().ToString(), |
| 261 left_bounds.size().ToString()); |
| 262 |
| 263 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); |
| 264 aura::client::ParentWindowWithContext( |
| 265 third.get(), wm_api.container(), gfx::Rect()); |
| 266 EXPECT_NE(wm_api.split_view_controller()->left_window(), third.get()); |
| 267 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); |
| 268 |
| 269 third->Hide(); |
| 270 EXPECT_EQ(left_bounds.ToString(), |
| 271 wm_api.split_view_controller()->left_window()->bounds().ToString()); |
| 272 } |
| 273 |
238 } // namespace athena | 274 } // namespace athena |
OLD | NEW |