| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "ash/common/shelf/shelf_application_menu_model.h" | 17 #include "ash/common/shelf/shelf_application_menu_model.h" |
| 18 #include "ash/common/shelf/shelf_constants.h" | 18 #include "ash/common/shelf/shelf_constants.h" |
| 19 #include "ash/common/shelf/shelf_controller.h" | 19 #include "ash/common/shelf/shelf_controller.h" |
| 20 #include "ash/common/shelf/shelf_model.h" | 20 #include "ash/common/shelf/shelf_model.h" |
| 21 #include "ash/common/shelf/shelf_model_observer.h" | 21 #include "ash/common/shelf/shelf_model_observer.h" |
| 22 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 22 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 23 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
| 24 #include "ash/display/display_configuration_controller.h" |
| 24 #include "ash/display/screen_orientation_controller_chromeos.h" | 25 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 25 #include "ash/public/cpp/app_launch_id.h" | 26 #include "ash/public/cpp/app_launch_id.h" |
| 26 #include "ash/public/cpp/shelf_item.h" | 27 #include "ash/public/cpp/shelf_item.h" |
| 27 #include "ash/shell.h" | 28 #include "ash/shell.h" |
| 28 #include "ash/test/ash_test_helper.h" | 29 #include "ash/test/ash_test_helper.h" |
| 29 #include "ash/test/shell_test_api.h" | 30 #include "ash/test/shell_test_api.h" |
| 30 #include "ash/test/test_shell_delegate.h" | 31 #include "ash/test/test_shell_delegate.h" |
| 31 #include "ash/wm/window_util.h" | 32 #include "ash/wm/window_util.h" |
| 32 #include "base/command_line.h" | 33 #include "base/command_line.h" |
| 33 #include "base/compiler_specific.h" | 34 #include "base/compiler_specific.h" |
| (...skipping 4028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4062 EnableTabletMode(true); | 4063 EnableTabletMode(true); |
| 4063 EXPECT_TRUE(controller->rotation_locked()); | 4064 EXPECT_TRUE(controller->rotation_locked()); |
| 4064 EXPECT_EQ(display::Display::ROTATE_90, | 4065 EXPECT_EQ(display::Display::ROTATE_90, |
| 4065 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | 4066 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 4066 | 4067 |
| 4067 // Manually unlock first. | 4068 // Manually unlock first. |
| 4068 NotifyOnTaskOrientationLockRequested(task_id_none_, OrientationLock::NONE); | 4069 NotifyOnTaskOrientationLockRequested(task_id_none_, OrientationLock::NONE); |
| 4069 EXPECT_FALSE(controller->rotation_locked()); | 4070 EXPECT_FALSE(controller->rotation_locked()); |
| 4070 } | 4071 } |
| 4071 | 4072 |
| 4072 TEST_P(ChromeLauncherControllerOrientationTest, CurrentWithLandscapeDisplay) { | |
| 4073 ASSERT_TRUE(display::Display::HasInternalDisplay()); | |
| 4074 | |
| 4075 extension_service_->AddExtension(arc_support_host_.get()); | |
| 4076 EnablePlayStore(true); | |
| 4077 EnableTabletMode(true); | |
| 4078 | |
| 4079 InitLauncherController(); | |
| 4080 | |
| 4081 InitApps(); | |
| 4082 ash::ScreenOrientationController* controller = | |
| 4083 ash::Shell::GetInstance()->screen_orientation_controller(); | |
| 4084 | |
| 4085 // Start with portrait. | |
| 4086 window_portrait_->Activate(); | |
| 4087 | |
| 4088 // Create a arc window to lock the CURRENT orientation. | |
| 4089 views::Widget* window_current = CreateArcWindow(window_app_id_current_); | |
| 4090 NotifyOnTaskCreated(appinfo_current_, task_id_current_); | |
| 4091 EXPECT_TRUE(controller->rotation_locked()); | |
| 4092 EXPECT_EQ(display::Display::ROTATE_90, | |
| 4093 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | |
| 4094 | |
| 4095 // Re-activating changes the orientation to previously locked orientation. | |
| 4096 window_landscape_->Activate(); | |
| 4097 EXPECT_TRUE(controller->rotation_locked()); | |
| 4098 EXPECT_EQ(display::Display::ROTATE_0, | |
| 4099 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | |
| 4100 window_current->Activate(); | |
| 4101 EXPECT_TRUE(controller->rotation_locked()); | |
| 4102 EXPECT_EQ(display::Display::ROTATE_90, | |
| 4103 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | |
| 4104 | |
| 4105 // Exitting and re-entering tablet mode re-locks the orientation. | |
| 4106 EnableTabletMode(false); | |
| 4107 EXPECT_FALSE(controller->rotation_locked()); | |
| 4108 EXPECT_EQ(display::Display::ROTATE_0, | |
| 4109 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | |
| 4110 | |
| 4111 EnableTabletMode(true); | |
| 4112 EXPECT_TRUE(window_current->IsActive()); | |
| 4113 EXPECT_TRUE(controller->rotation_locked()); | |
| 4114 EXPECT_EQ(display::Display::ROTATE_90, | |
| 4115 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | |
| 4116 | |
| 4117 // Manually unlock, and lock again at landscape. | |
| 4118 NotifyOnTaskOrientationLockRequested(task_id_current_, OrientationLock::NONE); | |
| 4119 window_landscape_->Activate(); | |
| 4120 EXPECT_TRUE(controller->rotation_locked()); | |
| 4121 window_current->Activate(); | |
| 4122 EXPECT_FALSE(controller->rotation_locked()); | |
| 4123 EXPECT_EQ(display::Display::ROTATE_0, | |
| 4124 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | |
| 4125 | |
| 4126 NotifyOnTaskOrientationLockRequested(task_id_current_, | |
| 4127 OrientationLock::CURRENT); | |
| 4128 EXPECT_TRUE(controller->rotation_locked()); | |
| 4129 EXPECT_EQ(display::Display::ROTATE_0, | |
| 4130 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | |
| 4131 } | |
| 4132 | |
| 4133 TEST_P(ChromeLauncherControllerArcDefaultAppsTest, DefaultApps) { | 4073 TEST_P(ChromeLauncherControllerArcDefaultAppsTest, DefaultApps) { |
| 4134 arc_test_.SetUp(profile()); | 4074 arc_test_.SetUp(profile()); |
| 4135 InitLauncherController(); | 4075 InitLauncherController(); |
| 4136 ChromeLauncherController::set_instance_for_test(launcher_controller_.get()); | 4076 ChromeLauncherController::set_instance_for_test(launcher_controller_.get()); |
| 4137 | 4077 |
| 4138 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); | 4078 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); |
| 4139 EnablePlayStore(false); | 4079 EnablePlayStore(false); |
| 4140 EXPECT_FALSE(arc::IsArcPlayStoreEnabledForProfile(profile())); | 4080 EXPECT_FALSE(arc::IsArcPlayStoreEnabledForProfile(profile())); |
| 4141 ASSERT_TRUE(prefs->GetAppIds().size()); | 4081 ASSERT_TRUE(prefs->GetAppIds().size()); |
| 4142 | 4082 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4395 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 4335 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
| 4396 shelf_controller->auto_hide()); | 4336 shelf_controller->auto_hide()); |
| 4397 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); | 4337 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); |
| 4398 | 4338 |
| 4399 PrefService* prefs = profile()->GetTestingPrefService(); | 4339 PrefService* prefs = profile()->GetTestingPrefService(); |
| 4400 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); | 4340 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); |
| 4401 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); | 4341 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); |
| 4402 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); | 4342 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); |
| 4403 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); | 4343 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); |
| 4404 } | 4344 } |
| OLD | NEW |