Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: ash/display/display_manager_unittest.cc

Issue 738243002: Notify primary display reassignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | ui/gfx/display_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_controller.h" 8 #include "ash/display/display_controller.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 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 DisplayLayout(DisplayLayout::TOP, -70).Invert().ToString()); 1374 DisplayLayout(DisplayLayout::TOP, -70).Invert().ToString());
1375 1375
1376 EXPECT_EQ("top, 0", 1376 EXPECT_EQ("top, 0",
1377 DisplayLayout(DisplayLayout::BOTTOM, 0).Invert().ToString()); 1377 DisplayLayout(DisplayLayout::BOTTOM, 0).Invert().ToString());
1378 EXPECT_EQ("top, -70", 1378 EXPECT_EQ("top, -70",
1379 DisplayLayout(DisplayLayout::BOTTOM, 70).Invert().ToString()); 1379 DisplayLayout(DisplayLayout::BOTTOM, 70).Invert().ToString());
1380 EXPECT_EQ("top, 80", 1380 EXPECT_EQ("top, 80",
1381 DisplayLayout(DisplayLayout::BOTTOM, -80).Invert().ToString()); 1381 DisplayLayout(DisplayLayout::BOTTOM, -80).Invert().ToString());
1382 } 1382 }
1383 1383
1384 TEST_F(DisplayManagerTest, NotifyPrimaryChange) {
1385 if (!SupportsMultipleDisplays())
1386 return;
1387 UpdateDisplay("500x500,500x500");
1388 ash::Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
1389 reset();
1390 UpdateDisplay("500x500");
1391 EXPECT_FALSE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1392 EXPECT_FALSE(changed_metrics() &
1393 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
1394 EXPECT_TRUE(changed_metrics() &
1395 gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY);
1396
1397 UpdateDisplay("500x500,500x500");
1398 ash::Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
1399 reset();
1400 UpdateDisplay("500x400");
1401 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1402 EXPECT_TRUE(changed_metrics() &
1403 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
1404 EXPECT_TRUE(changed_metrics() &
1405 gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY);
1406 }
1407
1408 TEST_F(DisplayManagerTest, NotifyPrimaryChangeUndock) {
1409 if (!SupportsMultipleDisplays())
1410 return;
1411 // Assume the default display is an external display, and
1412 // emulates undocking by switching to another display.
1413 DisplayInfo another_display_info =
1414 CreateDisplayInfo(1, gfx::Rect(0, 0, 1280, 800));
1415 std::vector<DisplayInfo> info_list;
1416 info_list.push_back(another_display_info);
1417 reset();
1418 display_manager()->OnNativeDisplaysChanged(info_list);
1419 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1420 EXPECT_TRUE(changed_metrics() &
1421 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
1422 EXPECT_TRUE(changed_metrics() &
1423 gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY);
1424 }
1425
1384 #if defined(OS_WIN) 1426 #if defined(OS_WIN)
1385 // TODO(scottmg): RootWindow doesn't get resized on Windows 1427 // TODO(scottmg): RootWindow doesn't get resized on Windows
1386 // Ash. http://crbug.com/247916. 1428 // Ash. http://crbug.com/247916.
1387 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin 1429 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin
1388 #else 1430 #else
1389 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin 1431 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin
1390 #endif 1432 #endif
1391 1433
1392 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { 1434 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) {
1393 UpdateDisplay("100x200,300x400"); 1435 UpdateDisplay("100x200,300x400");
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); 1596 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL);
1555 ASSERT_DOUBLE_EQ( 1597 ASSERT_DOUBLE_EQ(
1556 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1598 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1557 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 1599 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1558 DisplayInfo::SetUse125DSFForUIScaling(false); 1600 DisplayInfo::SetUse125DSFForUIScaling(false);
1559 } 1601 }
1560 1602
1561 #endif // OS_CHROMEOS 1603 #endif // OS_CHROMEOS
1562 1604
1563 } // namespace ash 1605 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ui/gfx/display_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698