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

Side by Side Diff: chrome/browser/extensions/display_info_provider_chromeos_unittest.cc

Issue 1838833002: Move DisplayLayout and DisplayLayoutBuilder From ash To ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screenwinmove
Patch Set: Fix comment Created 4 years, 8 months 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
OLDNEW
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 "extensions/browser/api/system_display/display_info_provider.h" 5 #include "extensions/browser/api/system_display/display_info_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
11 #include "ash/display/screen_orientation_controller_chromeos.h" 11 #include "ash/display/screen_orientation_controller_chromeos.h"
12 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/test/ash_test_base.h" 14 #include "ash/test/ash_test_base.h"
15 #include "ash/test/display_manager_test_api.h" 15 #include "ash/test/display_manager_test_api.h"
16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 16 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
21 #include "extensions/common/api/system_display.h" 21 #include "extensions/common/api/system_display.h"
22 #include "ui/display/manager/display_layout.h"
22 #include "ui/gfx/display.h" 23 #include "ui/gfx/display.h"
23 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
24 25
25 namespace extensions { 26 namespace extensions {
26 namespace { 27 namespace {
27 28
28 class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase { 29 class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase {
29 public: 30 public:
30 DisplayInfoProviderChromeosTest() {} 31 DisplayInfoProviderChromeosTest() {}
31 32
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 ASSERT_EQ(2u, result.size()); 395 ASSERT_EQ(2u, result.size());
395 EXPECT_EQ(base::Int64ToString(display_id_primary), result[0].id); 396 EXPECT_EQ(base::Int64ToString(display_id_primary), result[0].id);
396 EXPECT_TRUE(result[0].mirroring_source_id.empty()); 397 EXPECT_TRUE(result[0].mirroring_source_id.empty());
397 EXPECT_EQ(base::Int64ToString(display_id_secondary), result[1].id); 398 EXPECT_EQ(base::Int64ToString(display_id_secondary), result[1].id);
398 EXPECT_TRUE(result[1].mirroring_source_id.empty()); 399 EXPECT_TRUE(result[1].mirroring_source_id.empty());
399 } 400 }
400 401
401 TEST_F(DisplayInfoProviderChromeosTest, GetBounds) { 402 TEST_F(DisplayInfoProviderChromeosTest, GetBounds) {
402 UpdateDisplay("600x600, 400x520"); 403 UpdateDisplay("600x600, 400x520");
403 GetDisplayManager()->SetLayoutForCurrentDisplays( 404 GetDisplayManager()->SetLayoutForCurrentDisplays(
404 ash::test::CreateDisplayLayout(ash::DisplayPlacement::LEFT, -40)); 405 ash::test::CreateDisplayLayout(display::DisplayPlacement::LEFT, -40));
405 406
406 DisplayInfo result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); 407 DisplayInfo result = DisplayInfoProvider::Get()->GetAllDisplaysInfo();
407 408
408 ASSERT_EQ(2u, result.size()); 409 ASSERT_EQ(2u, result.size());
409 EXPECT_EQ("0,0 600x600", SystemInfoDisplayBoundsToString(result[0].bounds)); 410 EXPECT_EQ("0,0 600x600", SystemInfoDisplayBoundsToString(result[0].bounds));
410 EXPECT_EQ("-400,-40 400x520", 411 EXPECT_EQ("-400,-40 400x520",
411 SystemInfoDisplayBoundsToString(result[1].bounds)); 412 SystemInfoDisplayBoundsToString(result[1].bounds));
412 413
413 GetDisplayManager()->SetLayoutForCurrentDisplays( 414 GetDisplayManager()->SetLayoutForCurrentDisplays(
414 ash::test::CreateDisplayLayout(ash::DisplayPlacement::TOP, 40)); 415 ash::test::CreateDisplayLayout(display::DisplayPlacement::TOP, 40));
415 416
416 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); 417 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo();
417 418
418 ASSERT_EQ(2u, result.size()); 419 ASSERT_EQ(2u, result.size());
419 EXPECT_EQ("0,0 600x600", SystemInfoDisplayBoundsToString(result[0].bounds)); 420 EXPECT_EQ("0,0 600x600", SystemInfoDisplayBoundsToString(result[0].bounds));
420 EXPECT_EQ("40,-520 400x520", 421 EXPECT_EQ("40,-520 400x520",
421 SystemInfoDisplayBoundsToString(result[1].bounds)); 422 SystemInfoDisplayBoundsToString(result[1].bounds));
422 423
423 GetDisplayManager()->SetLayoutForCurrentDisplays( 424 GetDisplayManager()->SetLayoutForCurrentDisplays(
424 ash::test::CreateDisplayLayout(ash::DisplayPlacement::BOTTOM, 80)); 425 ash::test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 80));
425 426
426 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo(); 427 result = DisplayInfoProvider::Get()->GetAllDisplaysInfo();
427 ASSERT_EQ(2u, result.size()); 428 ASSERT_EQ(2u, result.size());
428 EXPECT_EQ("0,0 600x600", SystemInfoDisplayBoundsToString(result[0].bounds)); 429 EXPECT_EQ("0,0 600x600", SystemInfoDisplayBoundsToString(result[0].bounds));
429 EXPECT_EQ("80,600 400x520", 430 EXPECT_EQ("80,600 400x520",
430 SystemInfoDisplayBoundsToString(result[1].bounds)); 431 SystemInfoDisplayBoundsToString(result[1].bounds));
431 } 432 }
432 433
433 TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftExact) { 434 TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftExact) {
434 UpdateDisplay("1200x600,520x400"); 435 UpdateDisplay("1200x600,520x400");
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 std::string error; 1065 std::string error;
1065 CallSetDisplayUnitInfo( 1066 CallSetDisplayUnitInfo(
1066 base::Int64ToString(internal_display_id), info, &success, &error); 1067 base::Int64ToString(internal_display_id), info, &success, &error);
1067 1068
1068 ASSERT_FALSE(success); 1069 ASSERT_FALSE(success);
1069 EXPECT_EQ("Overscan changes not allowed for the internal monitor.", error); 1070 EXPECT_EQ("Overscan changes not allowed for the internal monitor.", error);
1070 } 1071 }
1071 1072
1072 } // namespace 1073 } // namespace
1073 } // namespace extensions 1074 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698