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/screen/public/screen_manager.h" | 7 #include "athena/screen/public/screen_manager.h" |
8 #include "athena/test/athena_test_base.h" | 8 #include "athena/test/athena_test_base.h" |
9 #include "athena/wm/public/window_list_provider.h" | 9 #include "athena/wm/public/window_list_provider.h" |
10 #include "athena/wm/split_view_controller.h" | 10 #include "athena/wm/split_view_controller.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 // Swipe the title of the right window now. It should switch to |third|. | 238 // Swipe the title of the right window now. It should switch to |third|. |
239 generator.GestureScrollSequence(gfx::Point(x_middle + 20, 10), | 239 generator.GestureScrollSequence(gfx::Point(x_middle + 20, 10), |
240 gfx::Point(x_middle + 20, 400), | 240 gfx::Point(x_middle + 20, 400), |
241 base::TimeDelta::FromMilliseconds(20), | 241 base::TimeDelta::FromMilliseconds(20), |
242 5); | 242 5); |
243 EXPECT_EQ(second.get(), wm_api.split_view_controller()->left_window()); | 243 EXPECT_EQ(second.get(), wm_api.split_view_controller()->left_window()); |
244 EXPECT_EQ(third.get(), wm_api.split_view_controller()->right_window()); | 244 EXPECT_EQ(third.get(), wm_api.split_view_controller()->right_window()); |
245 } | 245 } |
246 | 246 |
| 247 TEST_F(WindowManagerTest, NewWindowBounds) { |
| 248 aura::test::TestWindowDelegate delegate; |
| 249 scoped_ptr<aura::Window> first(CreateWindow(&delegate)); |
| 250 |
| 251 WindowManagerImplTestApi wm_api; |
| 252 aura::client::ParentWindowWithContext( |
| 253 first.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
| 254 // The window should have the same size as the container. |
| 255 const gfx::Size work_area = |
| 256 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size(); |
| 257 EXPECT_EQ(work_area.ToString(), |
| 258 first->bounds().size().ToString()); |
| 259 EXPECT_TRUE(first->bounds().origin().IsOrigin()); |
| 260 |
| 261 // A second window should have the same bounds as the first one. |
| 262 scoped_ptr<aura::Window> second(CreateWindow(&delegate)); |
| 263 aura::client::ParentWindowWithContext( |
| 264 second.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
| 265 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); |
| 266 |
| 267 // Get into split view. |
| 268 wm_api.split_view_controller()->ActivateSplitMode(NULL, NULL); |
| 269 const gfx::Rect left_bounds = |
| 270 wm_api.split_view_controller()->left_window()->bounds(); |
| 271 EXPECT_NE(work_area.ToString(), |
| 272 left_bounds.size().ToString()); |
| 273 |
| 274 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); |
| 275 aura::client::ParentWindowWithContext( |
| 276 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
| 277 EXPECT_NE(wm_api.split_view_controller()->left_window(), third.get()); |
| 278 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); |
| 279 |
| 280 third->Hide(); |
| 281 EXPECT_EQ(left_bounds.ToString(), |
| 282 wm_api.split_view_controller()->left_window()->bounds().ToString()); |
| 283 } |
| 284 |
247 } // namespace athena | 285 } // namespace athena |
OLD | NEW |