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

Side by Side Diff: ash/content/display/screen_orientation_controller_chromeos_unittest.cc

Issue 2270553002: Move ash::DisplayInfo to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build Created 4 years, 3 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 "ash/display/screen_orientation_controller_chromeos.h" 5 #include "ash/display/screen_orientation_controller_chromeos.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
11 #include "ash/common/display/display_info.h"
12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
13 #include "ash/common/wm_shell.h" 12 #include "ash/common/wm_shell.h"
14 #include "ash/content/shell_content_state.h" 13 #include "ash/content/shell_content_state.h"
15 #include "ash/display/display_manager.h" 14 #include "ash/display/display_manager.h"
16 #include "ash/shell.h" 15 #include "ash/shell.h"
17 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
18 #include "ash/test/ash_test_helper.h" 17 #include "ash/test/ash_test_helper.h"
19 #include "ash/test/content/test_shell_content_state.h" 18 #include "ash/test/content/test_shell_content_state.h"
20 #include "ash/test/display_manager_test_api.h" 19 #include "ash/test/display_manager_test_api.h"
21 #include "ash/test/test_shell_delegate.h" 20 #include "ash/test/test_shell_delegate.h"
22 #include "ash/test/test_system_tray_delegate.h" 21 #include "ash/test/test_system_tray_delegate.h"
23 #include "base/command_line.h" 22 #include "base/command_line.h"
24 #include "chromeos/accelerometer/accelerometer_reader.h" 23 #include "chromeos/accelerometer/accelerometer_reader.h"
25 #include "chromeos/accelerometer/accelerometer_types.h" 24 #include "chromeos/accelerometer/accelerometer_types.h"
26 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
27 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
28 #include "content/public/test/test_browser_context.h" 27 #include "content/public/test/test_browser_context.h"
29 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 28 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
30 #include "ui/aura/window.h" 29 #include "ui/aura/window.h"
31 #include "ui/display/display.h" 30 #include "ui/display/display.h"
31 #include "ui/display/manager/managed_display_info.h"
32 #include "ui/message_center/message_center.h" 32 #include "ui/message_center/message_center.h"
33 #include "ui/views/test/webview_test_helper.h" 33 #include "ui/views/test/webview_test_helper.h"
34 #include "ui/views/view.h" 34 #include "ui/views/view.h"
35 #include "ui/views/views_delegate.h" 35 #include "ui/views/views_delegate.h"
36 #include "ui/wm/public/activation_client.h" 36 #include "ui/wm/public/activation_client.h"
37 37
38 namespace ash { 38 namespace ash {
39 39
40 namespace { 40 namespace {
41 41
42 const float kDegreesToRadians = 3.1415926f / 180.0f; 42 const float kDegreesToRadians = 3.1415926f / 180.0f;
43 const float kMeanGravity = -9.8066f; 43 const float kMeanGravity = -9.8066f;
44 44
45 DisplayInfo CreateDisplayInfo(int64_t id, const gfx::Rect& bounds) { 45 ui::ManagedDisplayInfo CreateDisplayInfo(int64_t id, const gfx::Rect& bounds) {
46 DisplayInfo info(id, "dummy", false); 46 ui::ManagedDisplayInfo info(id, "dummy", false);
47 info.SetBounds(bounds); 47 info.SetBounds(bounds);
48 return info; 48 return info;
49 } 49 }
50 50
51 void EnableMaximizeMode(bool enable) { 51 void EnableMaximizeMode(bool enable) {
52 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( 52 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
53 enable); 53 enable);
54 } 54 }
55 55
56 bool RotationLocked() { 56 bool RotationLocked() {
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 SetInternalDisplayRotation(display::Display::ROTATE_90); 616 SetInternalDisplayRotation(display::Display::ROTATE_90);
617 EXPECT_TRUE(RotationLocked()); 617 EXPECT_TRUE(RotationLocked());
618 } 618 }
619 619
620 // Verifies rotating an inactive Display is successful. 620 // Verifies rotating an inactive Display is successful.
621 TEST_F(ScreenOrientationControllerTest, RotateInactiveDisplay) { 621 TEST_F(ScreenOrientationControllerTest, RotateInactiveDisplay) {
622 const int64_t kInternalDisplayId = 9; 622 const int64_t kInternalDisplayId = 9;
623 const int64_t kExternalDisplayId = 10; 623 const int64_t kExternalDisplayId = 10;
624 const display::Display::Rotation kNewRotation = display::Display::ROTATE_180; 624 const display::Display::Rotation kNewRotation = display::Display::ROTATE_180;
625 625
626 const DisplayInfo internal_display_info = 626 const ui::ManagedDisplayInfo internal_display_info =
627 CreateDisplayInfo(kInternalDisplayId, gfx::Rect(0, 0, 500, 500)); 627 CreateDisplayInfo(kInternalDisplayId, gfx::Rect(0, 0, 500, 500));
628 const DisplayInfo external_display_info = 628 const ui::ManagedDisplayInfo external_display_info =
629 CreateDisplayInfo(kExternalDisplayId, gfx::Rect(1, 1, 500, 500)); 629 CreateDisplayInfo(kExternalDisplayId, gfx::Rect(1, 1, 500, 500));
630 630
631 std::vector<DisplayInfo> display_info_list_two_active; 631 std::vector<ui::ManagedDisplayInfo> display_info_list_two_active;
632 display_info_list_two_active.push_back(internal_display_info); 632 display_info_list_two_active.push_back(internal_display_info);
633 display_info_list_two_active.push_back(external_display_info); 633 display_info_list_two_active.push_back(external_display_info);
634 634
635 std::vector<DisplayInfo> display_info_list_one_active; 635 std::vector<ui::ManagedDisplayInfo> display_info_list_one_active;
636 display_info_list_one_active.push_back(external_display_info); 636 display_info_list_one_active.push_back(external_display_info);
637 637
638 // The DisplayInfo list with two active displays needs to be added first so 638 // The ui::ManagedDisplayInfo list with two active displays needs to be added
639 // first
640 // so
oshima 2016/08/26 21:47:53 nit: format
rjkroege 2016/08/29 22:21:59 Done.
639 // that the DisplayManager can track the |internal_display_info| as inactive 641 // that the DisplayManager can track the |internal_display_info| as inactive
640 // instead of non-existent. 642 // instead of non-existent.
641 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 643 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
642 display_manager->UpdateDisplaysWith(display_info_list_two_active); 644 display_manager->UpdateDisplaysWith(display_info_list_two_active);
643 display_manager->UpdateDisplaysWith(display_info_list_one_active); 645 display_manager->UpdateDisplaysWith(display_info_list_one_active);
644 646
645 test::ScopedSetInternalDisplayId set_internal(kInternalDisplayId); 647 test::ScopedSetInternalDisplayId set_internal(kInternalDisplayId);
646 648
647 ASSERT_NE( 649 ASSERT_NE(
648 kNewRotation, 650 kNewRotation,
649 display_manager->GetDisplayInfo(kInternalDisplayId).GetActiveRotation()); 651 display_manager->GetDisplayInfo(kInternalDisplayId).GetActiveRotation());
650 652
651 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( 653 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation(
652 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); 654 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE);
653 655
654 EXPECT_EQ( 656 EXPECT_EQ(
655 kNewRotation, 657 kNewRotation,
656 display_manager->GetDisplayInfo(kInternalDisplayId).GetActiveRotation()); 658 display_manager->GetDisplayInfo(kInternalDisplayId).GetActiveRotation());
657 } 659 }
658 660
659 } // namespace ash 661 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698