| 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/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_commands.h" | 7 #include "ash/accelerators/accelerator_commands.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/display/display_info.h" | 9 #include "ash/display/display_info.h" |
| 10 #include "ash/display/display_layout_builder.h" | 10 #include "ash/display/display_layout_builder.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 UpdateDisplay("640x480,320x200,400x300"); | 323 UpdateDisplay("640x480,320x200,400x300"); |
| 324 | 324 |
| 325 EXPECT_EQ("0,0 640x480", | 325 EXPECT_EQ("0,0 640x480", |
| 326 display_manager()->GetDisplayAt(0).bounds().ToString()); | 326 display_manager()->GetDisplayAt(0).bounds().ToString()); |
| 327 EXPECT_EQ("10,480 320x200", | 327 EXPECT_EQ("10,480 320x200", |
| 328 display_manager()->GetDisplayAt(1).bounds().ToString()); | 328 display_manager()->GetDisplayAt(1).bounds().ToString()); |
| 329 EXPECT_EQ("20,680 400x300", | 329 EXPECT_EQ("20,680 400x300", |
| 330 display_manager()->GetDisplayAt(2).bounds().ToString()); | 330 display_manager()->GetDisplayAt(2).bounds().ToString()); |
| 331 } | 331 } |
| 332 | 332 |
| 333 TEST_F(DisplayManagerTest, LayoutMorethanThreeDisplaysCrashTest) { |
| 334 if (!SupportsMultipleDisplays()) |
| 335 return; |
| 336 |
| 337 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); |
| 338 DisplayIdList list = |
| 339 ash::test::CreateDisplayIdList2(primary_id, primary_id + 1); |
| 340 |
| 341 DisplayLayoutBuilder builder(primary_id); |
| 342 builder.AddDisplayPlacement(list[1], primary_id, DisplayPlacement::LEFT, 10); |
| 343 builder.AddDisplayPlacement(primary_id + 2, list[1], DisplayPlacement::TOP, |
| 344 10); |
| 345 display_manager()->layout_store()->RegisterLayoutForDisplayIdList( |
| 346 list, builder.Build()); |
| 347 UpdateDisplay("640x480, 500x500"); |
| 348 } |
| 349 |
| 333 TEST_F(DisplayManagerTest, LayoutMorethanThreeDisplaysTest) { | 350 TEST_F(DisplayManagerTest, LayoutMorethanThreeDisplaysTest) { |
| 334 if (!SupportsMultipleDisplays()) | 351 if (!SupportsMultipleDisplays()) |
| 335 return; | 352 return; |
| 336 | 353 |
| 337 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); | 354 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); |
| 338 DisplayIdList list = ash::test::CreateDisplayIdListN( | 355 DisplayIdList list = ash::test::CreateDisplayIdListN( |
| 339 3, primary_id, primary_id + 1, primary_id + 2); | 356 3, primary_id, primary_id + 1, primary_id + 2); |
| 340 { | 357 { |
| 341 // Layout: [2] | 358 // Layout: [2] |
| 342 // [1][P] | 359 // [1][P] |
| (...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2212 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); | 2229 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); |
| 2213 const DisplayLayout& stored = layout_store->GetRegisteredDisplayLayout(list); | 2230 const DisplayLayout& stored = layout_store->GetRegisteredDisplayLayout(list); |
| 2214 | 2231 |
| 2215 EXPECT_EQ(id1, stored.placement_list[0]->parent_display_id); | 2232 EXPECT_EQ(id1, stored.placement_list[0]->parent_display_id); |
| 2216 EXPECT_EQ(id2, stored.placement_list[0]->display_id); | 2233 EXPECT_EQ(id2, stored.placement_list[0]->display_id); |
| 2217 } | 2234 } |
| 2218 | 2235 |
| 2219 #endif // OS_CHROMEOS | 2236 #endif // OS_CHROMEOS |
| 2220 | 2237 |
| 2221 } // namespace ash | 2238 } // namespace ash |
| OLD | NEW |