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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc

Issue 2802403002: Resolve current orientation after applying the previous orientation request. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_item_types.h" 20 #include "ash/common/shelf/shelf_item_types.h"
21 #include "ash/common/shelf/shelf_model.h" 21 #include "ash/common/shelf/shelf_model.h"
22 #include "ash/common/shelf/shelf_model_observer.h" 22 #include "ash/common/shelf/shelf_model_observer.h"
23 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 23 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
24 #include "ash/common/wm_shell.h" 24 #include "ash/common/wm_shell.h"
25 #include "ash/display/display_configuration_controller.h"
25 #include "ash/display/screen_orientation_controller_chromeos.h" 26 #include "ash/display/screen_orientation_controller_chromeos.h"
26 #include "ash/shell.h" 27 #include "ash/shell.h"
27 #include "ash/test/ash_test_helper.h" 28 #include "ash/test/ash_test_helper.h"
28 #include "ash/test/test_shell_delegate.h" 29 #include "ash/test/test_shell_delegate.h"
29 #include "ash/wm/window_util.h" 30 #include "ash/wm/window_util.h"
30 #include "base/command_line.h" 31 #include "base/command_line.h"
31 #include "base/compiler_specific.h" 32 #include "base/compiler_specific.h"
32 #include "base/files/file_path.h" 33 #include "base/files/file_path.h"
33 #include "base/json/json_string_value_serializer.h" 34 #include "base/json/json_string_value_serializer.h"
34 #include "base/location.h" 35 #include "base/location.h"
(...skipping 4021 matching lines...) Expand 10 before | Expand all | Expand 10 after
4056 EnableTabletMode(true); 4057 EnableTabletMode(true);
4057 EXPECT_TRUE(controller->rotation_locked()); 4058 EXPECT_TRUE(controller->rotation_locked());
4058 EXPECT_EQ(display::Display::ROTATE_90, 4059 EXPECT_EQ(display::Display::ROTATE_90,
4059 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); 4060 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4060 4061
4061 // Manually unlock first. 4062 // Manually unlock first.
4062 NotifyOnTaskOrientationLockRequested(task_id_none_, OrientationLock::NONE); 4063 NotifyOnTaskOrientationLockRequested(task_id_none_, OrientationLock::NONE);
4063 EXPECT_FALSE(controller->rotation_locked()); 4064 EXPECT_FALSE(controller->rotation_locked());
4064 } 4065 }
4065 4066
4066 TEST_F(ChromeLauncherControllerOrientationTest, CurrentWithLandscapeDisplay) {
4067 ASSERT_TRUE(display::Display::HasInternalDisplay());
4068
4069 extension_service_->AddExtension(arc_support_host_.get());
4070 EnableArc(true);
4071 EnableTabletMode(true);
4072
4073 InitLauncherController();
4074
4075 InitApps();
4076 ash::ScreenOrientationController* controller =
4077 ash::Shell::GetInstance()->screen_orientation_controller();
4078
4079 // Start with portrait.
4080 window_portrait_->Activate();
4081
4082 // Create a arc window to lock the CURRENT orientation.
4083 views::Widget* window_current = CreateArcWindow(window_app_id_current_);
4084 NotifyOnTaskCreated(appinfo_current_, task_id_current_);
4085 EXPECT_TRUE(controller->rotation_locked());
4086 EXPECT_EQ(display::Display::ROTATE_90,
4087 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4088
4089 // Re-activating changes the orientation to previously locked orientation.
4090 window_landscape_->Activate();
4091 EXPECT_TRUE(controller->rotation_locked());
4092 EXPECT_EQ(display::Display::ROTATE_0,
4093 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4094 window_current->Activate();
4095 EXPECT_TRUE(controller->rotation_locked());
4096 EXPECT_EQ(display::Display::ROTATE_90,
4097 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4098
4099 // Exitting and re-entering tablet mode re-locks the orientation.
4100 EnableTabletMode(false);
4101 EXPECT_FALSE(controller->rotation_locked());
4102 EXPECT_EQ(display::Display::ROTATE_0,
4103 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4104
4105 EnableTabletMode(true);
4106 EXPECT_TRUE(window_current->IsActive());
4107 EXPECT_TRUE(controller->rotation_locked());
4108 EXPECT_EQ(display::Display::ROTATE_90,
4109 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4110
4111 // Manually unlock, and lock again at landscape.
4112 NotifyOnTaskOrientationLockRequested(task_id_current_, OrientationLock::NONE);
4113 window_landscape_->Activate();
4114 EXPECT_TRUE(controller->rotation_locked());
4115 window_current->Activate();
4116 EXPECT_FALSE(controller->rotation_locked());
4117 EXPECT_EQ(display::Display::ROTATE_0,
4118 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4119
4120 NotifyOnTaskOrientationLockRequested(task_id_current_,
4121 OrientationLock::CURRENT);
4122 EXPECT_TRUE(controller->rotation_locked());
4123 EXPECT_EQ(display::Display::ROTATE_0,
4124 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
4125 }
4126 4067
4127 TEST_F(ChromeLauncherControllerArcDefaultAppsTest, DefaultApps) { 4068 TEST_F(ChromeLauncherControllerArcDefaultAppsTest, DefaultApps) {
4128 arc_test_.SetUp(profile()); 4069 arc_test_.SetUp(profile());
4129 InitLauncherController(); 4070 InitLauncherController();
4130 ChromeLauncherController::set_instance_for_test(launcher_controller_.get()); 4071 ChromeLauncherController::set_instance_for_test(launcher_controller_.get());
4131 4072
4132 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); 4073 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs();
4133 EnableArc(false); 4074 EnableArc(false);
4134 EXPECT_FALSE(arc::IsArcPlayStoreEnabledForProfile(profile())); 4075 EXPECT_FALSE(arc::IsArcPlayStoreEnabledForProfile(profile()));
4135 ASSERT_TRUE(prefs->GetAppIds().size()); 4076 ASSERT_TRUE(prefs->GetAppIds().size());
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
4389 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, 4330 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
4390 shelf_controller->auto_hide()); 4331 shelf_controller->auto_hide());
4391 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); 4332 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count());
4392 4333
4393 PrefService* prefs = profile()->GetTestingPrefService(); 4334 PrefService* prefs = profile()->GetTestingPrefService();
4394 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); 4335 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal));
4395 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); 4336 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment));
4396 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); 4337 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal));
4397 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); 4338 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior));
4398 } 4339 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698