| 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_store.h" | 10 #include "ash/display/display_layout_store.h" |
| (...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 TEST_F(DisplayManagerTest, UnifiedWithDockWindows) { | 1992 TEST_F(DisplayManagerTest, UnifiedWithDockWindows) { |
| 1993 if (!SupportsMultipleDisplays()) | 1993 if (!SupportsMultipleDisplays()) |
| 1994 return; | 1994 return; |
| 1995 display_manager()->SetUnifiedDesktopEnabled(true); | 1995 display_manager()->SetUnifiedDesktopEnabled(true); |
| 1996 | 1996 |
| 1997 // Don't check root window destruction in unified mode. | 1997 // Don't check root window destruction in unified mode. |
| 1998 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 1998 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
| 1999 | 1999 |
| 2000 UpdateDisplay("400x500,300x200"); | 2000 UpdateDisplay("400x500,300x200"); |
| 2001 | 2001 |
| 2002 scoped_ptr<aura::Window> docked( | 2002 std::unique_ptr<aura::Window> docked( |
| 2003 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 50, 50))); | 2003 CreateTestWindowInShellWithBounds(gfx::Rect(10, 10, 50, 50))); |
| 2004 docked->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); | 2004 docked->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); |
| 2005 ASSERT_TRUE(wm::GetWindowState(docked.get())->IsDocked()); | 2005 ASSERT_TRUE(wm::GetWindowState(docked.get())->IsDocked()); |
| 2006 // 47 pixels reserved for launcher shelf height. | 2006 // 47 pixels reserved for launcher shelf height. |
| 2007 EXPECT_EQ("0,0 250x453", docked->bounds().ToString()); | 2007 EXPECT_EQ("0,0 250x453", docked->bounds().ToString()); |
| 2008 UpdateDisplay("300x300"); | 2008 UpdateDisplay("300x300"); |
| 2009 // Make sure the window is still docked. | 2009 // Make sure the window is still docked. |
| 2010 EXPECT_TRUE(wm::GetWindowState(docked.get())->IsDocked()); | 2010 EXPECT_TRUE(wm::GetWindowState(docked.get())->IsDocked()); |
| 2011 EXPECT_EQ("0,0 250x253", docked->bounds().ToString()); | 2011 EXPECT_EQ("0,0 250x253", docked->bounds().ToString()); |
| 2012 } | 2012 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 info.GetRotation(gfx::Display::ROTATION_SOURCE_ACTIVE)); | 2239 info.GetRotation(gfx::Display::ROTATION_SOURCE_ACTIVE)); |
| 2240 } | 2240 } |
| 2241 | 2241 |
| 2242 TEST_F(DisplayManagerTest, RejectInvalidLayoutData) { | 2242 TEST_F(DisplayManagerTest, RejectInvalidLayoutData) { |
| 2243 DisplayLayoutStore* layout_store = display_manager()->layout_store(); | 2243 DisplayLayoutStore* layout_store = display_manager()->layout_store(); |
| 2244 int64_t id1 = 10001; | 2244 int64_t id1 = 10001; |
| 2245 int64_t id2 = 10002; | 2245 int64_t id2 = 10002; |
| 2246 ASSERT_TRUE(CompareDisplayIds(id1, id2)); | 2246 ASSERT_TRUE(CompareDisplayIds(id1, id2)); |
| 2247 display::DisplayLayoutBuilder good_builder(id1); | 2247 display::DisplayLayoutBuilder good_builder(id1); |
| 2248 good_builder.SetSecondaryPlacement(id2, display::DisplayPlacement::LEFT, 0); | 2248 good_builder.SetSecondaryPlacement(id2, display::DisplayPlacement::LEFT, 0); |
| 2249 scoped_ptr<display::DisplayLayout> good(good_builder.Build()); | 2249 std::unique_ptr<display::DisplayLayout> good(good_builder.Build()); |
| 2250 | 2250 |
| 2251 display::DisplayIdList good_list = test::CreateDisplayIdList2(id1, id2); | 2251 display::DisplayIdList good_list = test::CreateDisplayIdList2(id1, id2); |
| 2252 layout_store->RegisterLayoutForDisplayIdList(good_list, good->Copy()); | 2252 layout_store->RegisterLayoutForDisplayIdList(good_list, good->Copy()); |
| 2253 | 2253 |
| 2254 display::DisplayLayoutBuilder bad(id1); | 2254 display::DisplayLayoutBuilder bad(id1); |
| 2255 bad.SetSecondaryPlacement(id2, display::DisplayPlacement::BOTTOM, 0); | 2255 bad.SetSecondaryPlacement(id2, display::DisplayPlacement::BOTTOM, 0); |
| 2256 | 2256 |
| 2257 display::DisplayIdList bad_list(2); | 2257 display::DisplayIdList bad_list(2); |
| 2258 bad_list[0] = id2; | 2258 bad_list[0] = id2; |
| 2259 bad_list[1] = id1; | 2259 bad_list[1] = id1; |
| 2260 layout_store->RegisterLayoutForDisplayIdList(bad_list, bad.Build()); | 2260 layout_store->RegisterLayoutForDisplayIdList(bad_list, bad.Build()); |
| 2261 | 2261 |
| 2262 EXPECT_EQ(good->ToString(), | 2262 EXPECT_EQ(good->ToString(), |
| 2263 layout_store->GetRegisteredDisplayLayout(good_list).ToString()); | 2263 layout_store->GetRegisteredDisplayLayout(good_list).ToString()); |
| 2264 } | 2264 } |
| 2265 | 2265 |
| 2266 TEST_F(DisplayManagerTest, GuessDisplayIdFieldsInDisplayLayout) { | 2266 TEST_F(DisplayManagerTest, GuessDisplayIdFieldsInDisplayLayout) { |
| 2267 int64_t id1 = 10001; | 2267 int64_t id1 = 10001; |
| 2268 int64_t id2 = 10002; | 2268 int64_t id2 = 10002; |
| 2269 | 2269 |
| 2270 scoped_ptr<display::DisplayLayout> old_layout(new display::DisplayLayout); | 2270 std::unique_ptr<display::DisplayLayout> old_layout( |
| 2271 new display::DisplayLayout); |
| 2271 old_layout->placement_list.emplace_back(display::DisplayPlacement::BOTTOM, 0); | 2272 old_layout->placement_list.emplace_back(display::DisplayPlacement::BOTTOM, 0); |
| 2272 old_layout->primary_id = id1; | 2273 old_layout->primary_id = id1; |
| 2273 | 2274 |
| 2274 DisplayLayoutStore* layout_store = display_manager()->layout_store(); | 2275 DisplayLayoutStore* layout_store = display_manager()->layout_store(); |
| 2275 display::DisplayIdList list = test::CreateDisplayIdList2(id1, id2); | 2276 display::DisplayIdList list = test::CreateDisplayIdList2(id1, id2); |
| 2276 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); | 2277 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); |
| 2277 const display::DisplayLayout& stored = | 2278 const display::DisplayLayout& stored = |
| 2278 layout_store->GetRegisteredDisplayLayout(list); | 2279 layout_store->GetRegisteredDisplayLayout(list); |
| 2279 | 2280 |
| 2280 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); | 2281 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); |
| 2281 EXPECT_EQ(id2, stored.placement_list[0].display_id); | 2282 EXPECT_EQ(id2, stored.placement_list[0].display_id); |
| 2282 } | 2283 } |
| 2283 | 2284 |
| 2284 #endif // OS_CHROMEOS | 2285 #endif // OS_CHROMEOS |
| 2285 | 2286 |
| 2286 } // namespace ash | 2287 } // namespace ash |
| OLD | NEW |