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

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

Issue 1540753002: Switch to standard integer types in ash/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arraysize Created 5 years 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/ash_touch_exploration_manager_chromeos.h ('k') | ash/content/gpu_support_impl.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 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 <vector> 5 #include <vector>
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/content/shell_content_state.h" 8 #include "ash/content/shell_content_state.h"
9 #include "ash/display/display_info.h" 9 #include "ash/display/display_info.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 22 matching lines...) Expand all
33 #include "ui/views/views_delegate.h" 33 #include "ui/views/views_delegate.h"
34 #include "ui/wm/public/activation_client.h" 34 #include "ui/wm/public/activation_client.h"
35 35
36 namespace ash { 36 namespace ash {
37 37
38 namespace { 38 namespace {
39 39
40 const float kDegreesToRadians = 3.1415926f / 180.0f; 40 const float kDegreesToRadians = 3.1415926f / 180.0f;
41 const float kMeanGravity = -9.8066f; 41 const float kMeanGravity = -9.8066f;
42 42
43 DisplayInfo CreateDisplayInfo(int64 id, const gfx::Rect& bounds) { 43 DisplayInfo CreateDisplayInfo(int64_t id, const gfx::Rect& bounds) {
44 DisplayInfo info(id, "dummy", false); 44 DisplayInfo info(id, "dummy", false);
45 info.SetBounds(bounds); 45 info.SetBounds(bounds);
46 return info; 46 return info;
47 } 47 }
48 48
49 void EnableMaximizeMode(bool enable) { 49 void EnableMaximizeMode(bool enable) {
50 Shell::GetInstance() 50 Shell::GetInstance()
51 ->maximize_mode_controller() 51 ->maximize_mode_controller()
52 ->EnableMaximizeModeWindowManager(enable); 52 ->EnableMaximizeModeWindowManager(enable);
53 } 53 }
54 54
55 bool RotationLocked() { 55 bool RotationLocked() {
56 return Shell::GetInstance() 56 return Shell::GetInstance()
57 ->screen_orientation_controller() 57 ->screen_orientation_controller()
58 ->rotation_locked(); 58 ->rotation_locked();
59 } 59 }
60 60
61 void SetDisplayRotationById(int64 display_id, gfx::Display::Rotation rotation) { 61 void SetDisplayRotationById(int64_t display_id,
62 gfx::Display::Rotation rotation) {
62 Shell::GetInstance()->display_manager()->SetDisplayRotation( 63 Shell::GetInstance()->display_manager()->SetDisplayRotation(
63 display_id, rotation, gfx::Display::ROTATION_SOURCE_USER); 64 display_id, rotation, gfx::Display::ROTATION_SOURCE_USER);
64 } 65 }
65 66
66 void SetInternalDisplayRotation(gfx::Display::Rotation rotation) { 67 void SetInternalDisplayRotation(gfx::Display::Rotation rotation) {
67 SetDisplayRotationById(gfx::Display::InternalDisplayId(), rotation); 68 SetDisplayRotationById(gfx::Display::InternalDisplayId(), rotation);
68 } 69 }
69 70
70 void SetRotationLocked(bool rotation_locked) { 71 void SetRotationLocked(bool rotation_locked) {
71 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( 72 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked(
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); 590 TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f));
590 EXPECT_EQ(gfx::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); 591 EXPECT_EQ(gfx::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
591 } 592 }
592 593
593 // Tests that when MaximizeMode is triggered before the internal display is 594 // Tests that when MaximizeMode is triggered before the internal display is
594 // ready, that ScreenOrientationController still begins listening to events, 595 // ready, that ScreenOrientationController still begins listening to events,
595 // which require an internal display to be acted upon. 596 // which require an internal display to be acted upon.
596 TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) { 597 TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) {
597 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 598 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
598 599
599 int64 internal_display_id = gfx::Display::InternalDisplayId(); 600 int64_t internal_display_id = gfx::Display::InternalDisplayId();
600 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); 601 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID);
601 602
602 EnableMaximizeMode(true); 603 EnableMaximizeMode(true);
603 604
604 // Should not crash, even though there is no internal display. 605 // Should not crash, even though there is no internal display.
605 SetDisplayRotationById(internal_display_id, gfx::Display::ROTATE_180); 606 SetDisplayRotationById(internal_display_id, gfx::Display::ROTATE_180);
606 EXPECT_FALSE(RotationLocked()); 607 EXPECT_FALSE(RotationLocked());
607 608
608 // Should not crash, even though the invalid display id is requested. 609 // Should not crash, even though the invalid display id is requested.
609 SetDisplayRotationById(gfx::Display::kInvalidDisplayID, 610 SetDisplayRotationById(gfx::Display::kInvalidDisplayID,
610 gfx::Display::ROTATE_180); 611 gfx::Display::ROTATE_180);
611 EXPECT_FALSE(RotationLocked()); 612 EXPECT_FALSE(RotationLocked());
612 613
613 // With an internal display now available, functionality should resume. 614 // With an internal display now available, functionality should resume.
614 gfx::Display::SetInternalDisplayId(internal_display_id); 615 gfx::Display::SetInternalDisplayId(internal_display_id);
615 SetInternalDisplayRotation(gfx::Display::ROTATE_90); 616 SetInternalDisplayRotation(gfx::Display::ROTATE_90);
616 EXPECT_TRUE(RotationLocked()); 617 EXPECT_TRUE(RotationLocked());
617 } 618 }
618 619
619 // Verifies rotating an inactive Display is successful. 620 // Verifies rotating an inactive Display is successful.
620 TEST_F(ScreenOrientationControllerTest, RotateInactiveDisplay) { 621 TEST_F(ScreenOrientationControllerTest, RotateInactiveDisplay) {
621 const int64 kInternalDisplayId = 9; 622 const int64_t kInternalDisplayId = 9;
622 const int64 kExternalDisplayId = 10; 623 const int64_t kExternalDisplayId = 10;
623 const gfx::Display::Rotation kNewRotation = gfx::Display::ROTATE_180; 624 const gfx::Display::Rotation kNewRotation = gfx::Display::ROTATE_180;
624 625
625 const DisplayInfo internal_display_info = 626 const DisplayInfo internal_display_info =
626 CreateDisplayInfo(kInternalDisplayId, gfx::Rect(0, 0, 500, 500)); 627 CreateDisplayInfo(kInternalDisplayId, gfx::Rect(0, 0, 500, 500));
627 const DisplayInfo external_display_info = 628 const DisplayInfo external_display_info =
628 CreateDisplayInfo(kExternalDisplayId, gfx::Rect(1, 1, 500, 500)); 629 CreateDisplayInfo(kExternalDisplayId, gfx::Rect(1, 1, 500, 500));
629 630
630 std::vector<DisplayInfo> display_info_list_two_active; 631 std::vector<DisplayInfo> display_info_list_two_active;
631 display_info_list_two_active.push_back(internal_display_info); 632 display_info_list_two_active.push_back(internal_display_info);
632 display_info_list_two_active.push_back(external_display_info); 633 display_info_list_two_active.push_back(external_display_info);
(...skipping 14 matching lines...) Expand all
647 .GetActiveRotation()); 648 .GetActiveRotation());
648 649
649 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( 650 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation(
650 kNewRotation, gfx::Display::ROTATION_SOURCE_ACTIVE); 651 kNewRotation, gfx::Display::ROTATION_SOURCE_ACTIVE);
651 652
652 EXPECT_EQ(kNewRotation, display_manager->GetDisplayInfo(kInternalDisplayId) 653 EXPECT_EQ(kNewRotation, display_manager->GetDisplayInfo(kInternalDisplayId)
653 .GetActiveRotation()); 654 .GetActiveRotation());
654 } 655 }
655 656
656 } // namespace ash 657 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash_touch_exploration_manager_chromeos.h ('k') | ash/content/gpu_support_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698