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

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

Issue 2112013002: Allow arc app to lock screen orientation in TouchView/Tablet mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit test Created 4 years, 5 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 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/ash_switches.h" 17 #include "ash/common/ash_switches.h"
18 #include "ash/common/shelf/shelf_item_delegate_manager.h" 18 #include "ash/common/shelf/shelf_item_delegate_manager.h"
19 #include "ash/common/shelf/shelf_model.h" 19 #include "ash/common/shelf/shelf_model.h"
20 #include "ash/common/shelf/shelf_model_observer.h" 20 #include "ash/common/shelf/shelf_model_observer.h"
21 #include "ash/display/screen_orientation_controller_chromeos.h"
21 #include "ash/shell.h" 22 #include "ash/shell.h"
22 #include "ash/test/ash_test_helper.h" 23 #include "ash/test/ash_test_helper.h"
23 #include "ash/test/shelf_item_delegate_manager_test_api.h" 24 #include "ash/test/shelf_item_delegate_manager_test_api.h"
24 #include "ash/test/test_session_state_delegate.h" 25 #include "ash/test/test_session_state_delegate.h"
25 #include "ash/test/test_shell_delegate.h" 26 #include "ash/test/test_shell_delegate.h"
27 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
28 #include "ash/wm/window_util.h"
26 #include "base/command_line.h" 29 #include "base/command_line.h"
27 #include "base/compiler_specific.h" 30 #include "base/compiler_specific.h"
28 #include "base/files/file_path.h" 31 #include "base/files/file_path.h"
29 #include "base/location.h" 32 #include "base/location.h"
30 #include "base/macros.h" 33 #include "base/macros.h"
31 #include "base/memory/ptr_util.h" 34 #include "base/memory/ptr_util.h"
32 #include "base/message_loop/message_loop.h" 35 #include "base/message_loop/message_loop.h"
33 #include "base/single_thread_task_runner.h" 36 #include "base/single_thread_task_runner.h"
34 #include "base/strings/utf_string_conversions.h" 37 #include "base/strings/utf_string_conversions.h"
35 #include "base/threading/thread_task_runner_handle.h" 38 #include "base/threading/thread_task_runner_handle.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "extensions/browser/app_window/native_app_window.h" 93 #include "extensions/browser/app_window/native_app_window.h"
91 #include "extensions/common/extension.h" 94 #include "extensions/common/extension.h"
92 #include "extensions/common/manifest_constants.h" 95 #include "extensions/common/manifest_constants.h"
93 #include "sync/api/fake_sync_change_processor.h" 96 #include "sync/api/fake_sync_change_processor.h"
94 #include "sync/api/sync_error_factory_mock.h" 97 #include "sync/api/sync_error_factory_mock.h"
95 #include "sync/protocol/sync.pb.h" 98 #include "sync/protocol/sync.pb.h"
96 #include "testing/gtest/include/gtest/gtest.h" 99 #include "testing/gtest/include/gtest/gtest.h"
97 #include "ui/aura/client/window_tree_client.h" 100 #include "ui/aura/client/window_tree_client.h"
98 #include "ui/aura/window.h" 101 #include "ui/aura/window.h"
99 #include "ui/base/models/menu_model.h" 102 #include "ui/base/models/menu_model.h"
103 #include "ui/display/display.h"
104 #include "ui/display/screen.h"
100 #include "ui/views/widget/widget.h" 105 #include "ui/views/widget/widget.h"
101 106
102 using base::ASCIIToUTF16; 107 using base::ASCIIToUTF16;
103 using extensions::Extension; 108 using extensions::Extension;
104 using extensions::Manifest; 109 using extensions::Manifest;
105 using extensions::UnloadedExtensionInfo; 110 using extensions::UnloadedExtensionInfo;
111 using arc::mojom::OrientationLock;
106 112
107 namespace { 113 namespace {
108 const char* offline_gmail_url = "https://mail.google.com/mail/mu/u"; 114 const char* offline_gmail_url = "https://mail.google.com/mail/mu/u";
109 const char* gmail_url = "https://mail.google.com/mail/u"; 115 const char* gmail_url = "https://mail.google.com/mail/u";
110 const char* kGmailLaunchURL = "https://mail.google.com/mail/ca"; 116 const char* kGmailLaunchURL = "https://mail.google.com/mail/ca";
111 117
112 // An extension prefix. 118 // An extension prefix.
113 const char kCrxAppPrefix[] = "_crx_"; 119 const char kCrxAppPrefix[] = "_crx_";
114 120
115 // Dummy app id is used to put at least one pin record to prevent initializing 121 // Dummy app id is used to put at least one pin record to prevent initializing
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 class ChromeLauncherControllerImplTest : public BrowserWithTestWindowTest { 304 class ChromeLauncherControllerImplTest : public BrowserWithTestWindowTest {
299 protected: 305 protected:
300 ChromeLauncherControllerImplTest() 306 ChromeLauncherControllerImplTest()
301 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false), 307 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false),
302 test_controller_(NULL), 308 test_controller_(NULL),
303 extension_service_(NULL) {} 309 extension_service_(NULL) {}
304 310
305 ~ChromeLauncherControllerImplTest() override {} 311 ~ChromeLauncherControllerImplTest() override {}
306 312
307 void SetUp() override { 313 void SetUp() override {
314 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
315 command_line->AppendSwitch(ash::switches::kAshUseFirstDisplayAsInternal);
316 command_line->AppendSwitch(ash::switches::kAshEnableTouchViewTesting);
317
308 app_list::AppListSyncableServiceFactory::SetUseInTesting(); 318 app_list::AppListSyncableServiceFactory::SetUseInTesting();
309 319
310 BrowserWithTestWindowTest::SetUp(); 320 BrowserWithTestWindowTest::SetUp();
311 321
312 if (!profile_manager_) { 322 if (!profile_manager_) {
313 profile_manager_.reset( 323 profile_manager_.reset(
314 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 324 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
315 ASSERT_TRUE(profile_manager_->SetUp()); 325 ASSERT_TRUE(profile_manager_->SetUp());
316 } 326 }
317 327
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 834 }
825 835
826 void EnableArc(bool enable) { 836 void EnableArc(bool enable) {
827 enable ? arc_test_.arc_auth_service()->EnableArc() 837 enable ? arc_test_.arc_auth_service()->EnableArc()
828 : arc_test_.arc_auth_service()->DisableArc(); 838 : arc_test_.arc_auth_service()->DisableArc();
829 arc_test_.arc_auth_service()->OnSyncedPrefChanged(prefs::kArcEnabled, 839 arc_test_.arc_auth_service()->OnSyncedPrefChanged(prefs::kArcEnabled,
830 false); 840 false);
831 base::RunLoop().RunUntilIdle(); 841 base::RunLoop().RunUntilIdle();
832 } 842 }
833 843
844 void EnableTabletMode(bool enable) {
845 ash::MaximizeModeController* controller =
846 ash::Shell::GetInstance()->maximize_mode_controller();
847 controller->EnableMaximizeModeWindowManager(enable);
848 }
849
834 void ValidateArcState(bool arc_enabled, 850 void ValidateArcState(bool arc_enabled,
835 bool arc_managed, 851 bool arc_managed,
836 arc::ArcAuthService::State state, 852 arc::ArcAuthService::State state,
837 const std::string& pin_status) { 853 const std::string& pin_status) {
838 EXPECT_EQ(arc_managed, arc_test_.arc_auth_service()->IsArcManaged()); 854 EXPECT_EQ(arc_managed, arc_test_.arc_auth_service()->IsArcManaged());
839 EXPECT_EQ(arc_enabled, arc_test_.arc_auth_service()->IsArcEnabled()); 855 EXPECT_EQ(arc_enabled, arc_test_.arc_auth_service()->IsArcEnabled());
840 EXPECT_EQ(state, arc_test_.arc_auth_service()->state()); 856 EXPECT_EQ(state, arc_test_.arc_auth_service()->state());
841 EXPECT_EQ(pin_status, GetPinnedAppStatus()); 857 EXPECT_EQ(pin_status, GetPinnedAppStatus());
842 } 858 }
843 859
844 // Creates app window and set optional Arc application id. 860 // Creates app window and set optional Arc application id.
845 views::Widget* CreateAppWindow(std::string* window_app_id) { 861 views::Widget* CreateArcWindow(std::string& window_app_id) {
846 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 862 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
847 params.bounds = gfx::Rect(5, 5, 20, 20); 863 params.bounds = gfx::Rect(5, 5, 20, 20);
864 params.context = GetContext();
848 views::Widget* widget = new views::Widget(); 865 views::Widget* widget = new views::Widget();
849 widget->Init(params); 866 widget->Init(params);
850 widget->Show(); 867 widget->Show();
851 widget->Activate(); 868 widget->Activate();
852 if (window_app_id) { 869 exo::ShellSurface::SetApplicationId(widget->GetNativeWindow(),
853 exo::ShellSurface::SetApplicationId(widget->GetNativeWindow(), 870 &window_app_id);
854 window_app_id);
855 }
856 return widget; 871 return widget;
857 } 872 }
858 873
874 arc::mojom::AppInfo CreateAppInfo(const std::string& name,
875 const std::string& activity,
876 const std::string& package_name,
877 OrientationLock lock) {
878 arc::mojom::AppInfo appinfo;
879 appinfo.name = name;
880 appinfo.package_name = package_name;
881 appinfo.activity = activity;
882 appinfo.orientation_lock = lock;
883 return appinfo;
884 }
885
886 std::string AddArcAppAndShortcut(const arc::mojom::AppInfo& app_info) {
887 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs();
888 // Adding app to the prefs, and check that the app is accessible by id.
889 prefs->AddAppAndShortcut(
890 app_info.name, app_info.package_name, app_info.activity,
891 std::string() /* intent_uri */, std::string() /* icon_resource_id */,
892 false /* sticky */, true /* notifications_enabled */,
893 false /* shortcut */, app_info.orientation_lock);
894 const std::string app_id =
895 ArcAppListPrefs::GetAppId(app_info.package_name, app_info.activity);
896 EXPECT_TRUE(prefs->GetApp(app_id));
897 return app_id;
898 }
899
900 void NotifyOnTaskCreated(const arc::mojom::AppInfo& appinfo,
901 int32_t task_id) {
902 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs();
903 prefs->OnTaskCreated(task_id, appinfo.package_name, appinfo.activity);
904 }
905
906 void NotifyOnTaskOrientationLockRequested(int32_t task_id,
907 OrientationLock lock) {
908 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs();
909 prefs->OnTaskOrientationLockRequested(task_id, lock);
910 }
911
859 // Needed for extension service & friends to work. 912 // Needed for extension service & friends to work.
860 scoped_refptr<Extension> extension1_; 913 scoped_refptr<Extension> extension1_;
861 scoped_refptr<Extension> extension2_; 914 scoped_refptr<Extension> extension2_;
862 scoped_refptr<Extension> extension3_; 915 scoped_refptr<Extension> extension3_;
863 scoped_refptr<Extension> extension4_; 916 scoped_refptr<Extension> extension4_;
864 scoped_refptr<Extension> extension5_; 917 scoped_refptr<Extension> extension5_;
865 scoped_refptr<Extension> extension6_; 918 scoped_refptr<Extension> extension6_;
866 scoped_refptr<Extension> extension7_; 919 scoped_refptr<Extension> extension7_;
867 scoped_refptr<Extension> extension8_; 920 scoped_refptr<Extension> extension8_;
868 scoped_refptr<Extension> arc_support_host_; 921 scoped_refptr<Extension> arc_support_host_;
(...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 launcher_controller_->CloseLauncherItem(shelfId3); 3390 launcher_controller_->CloseLauncherItem(shelfId3);
3338 EXPECT_EQ(1, app_icon_loader1->fetch_count()); 3391 EXPECT_EQ(1, app_icon_loader1->fetch_count());
3339 EXPECT_EQ(1, app_icon_loader1->clear_count()); 3392 EXPECT_EQ(1, app_icon_loader1->clear_count());
3340 EXPECT_EQ(1, app_icon_loader2->fetch_count()); 3393 EXPECT_EQ(1, app_icon_loader2->fetch_count());
3341 EXPECT_EQ(1, app_icon_loader2->clear_count()); 3394 EXPECT_EQ(1, app_icon_loader2->clear_count());
3342 } 3395 }
3343 3396
3344 TEST_F(ChromeLauncherControllerImplTest, ArcAppPinPolicy) { 3397 TEST_F(ChromeLauncherControllerImplTest, ArcAppPinPolicy) {
3345 arc_test_.SetUp(profile()); 3398 arc_test_.SetUp(profile());
3346 InitLauncherControllerWithBrowser(); 3399 InitLauncherControllerWithBrowser();
3347 3400 arc::mojom::AppInfo appinfo = CreateAppInfo(
3348 arc::mojom::AppInfo appinfo; 3401 "Some App", "SomeActivity", "com.example.app", OrientationLock::NONE);
3349 appinfo.name = "Some App"; 3402 const std::string app_id = AddArcAppAndShortcut(appinfo);
3350 appinfo.activity = "SomeActivity";
3351 appinfo.package_name = "com.example.app";
3352
3353 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs();
3354 ASSERT_TRUE(prefs);
3355
3356 // Adding app to the prefs, and check that the app is accessible by id.
3357 prefs->AddAppAndShortcut(appinfo.name, appinfo.package_name, appinfo.activity,
3358 std::string() /* intent_uri */,
3359 std::string() /* icon_resource_id */,
3360 false /* sticky */, true /* notifications_enabled */,
3361 false /* shortcut */);
3362 const std::string app_id =
3363 ArcAppListPrefs::GetAppId(appinfo.package_name, appinfo.activity);
3364 EXPECT_TRUE(prefs->GetApp(app_id));
3365 3403
3366 // Set policy, that makes pins ARC app. Unlike native extension, for ARC app 3404 // Set policy, that makes pins ARC app. Unlike native extension, for ARC app
3367 // package_name (not hash) specified as id. In this test we check that 3405 // package_name (not hash) specified as id. In this test we check that
3368 // by hash we can determine that appropriate package was set by policy. 3406 // by hash we can determine that appropriate package was set by policy.
3369 base::ListValue policy_value; 3407 base::ListValue policy_value;
3370 InsertPrefValue(&policy_value, 0, appinfo.package_name); 3408 InsertPrefValue(&policy_value, 0, appinfo.package_name);
3371 profile()->GetTestingPrefService()->SetManagedPref( 3409 profile()->GetTestingPrefService()->SetManagedPref(
3372 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy()); 3410 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy());
3373 3411
3374 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); 3412 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 // be automatically removed. 3457 // be automatically removed.
3420 EnableArc(false); 3458 EnableArc(false);
3421 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED, 3459 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED,
3422 "AppList, Chrome"); 3460 "AppList, Chrome");
3423 3461
3424 // Even if re-enable it again, Play Store pin does not appear automatically. 3462 // Even if re-enable it again, Play Store pin does not appear automatically.
3425 EnableArc(true); 3463 EnableArc(true);
3426 ValidateArcState(true, false, arc::ArcAuthService::State::FETCHING_CODE, 3464 ValidateArcState(true, false, arc::ArcAuthService::State::FETCHING_CODE,
3427 "AppList, Chrome"); 3465 "AppList, Chrome");
3428 } 3466 }
3467
3468 TEST_F(ChromeLauncherControllerImplTest, ArcOrientationLock) {
3469 DCHECK(display::Display::HasInternalDisplay());
3470
3471 extension_service_->AddExtension(arc_support_host_.get());
3472 arc_test_.SetUp(profile());
3473 EnableArc(true);
3474 EnableTabletMode(true);
3475
3476 InitLauncherController();
3477 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get());
3478 arc::mojom::AppInfo appinfo_none =
3479 CreateAppInfo("None", "None", "com.example.app", OrientationLock::NONE);
3480 arc::mojom::AppInfo appinfo_landscape = CreateAppInfo(
3481 "Landscape", "Landscape", "com.example.app", OrientationLock::LANDSCAPE);
3482 arc::mojom::AppInfo appinfo_portrait = CreateAppInfo(
3483 "Portrait", "Portrait", "com.example.app", OrientationLock::PORTRAIT);
3484
3485 const std::string app_id_none = AddArcAppAndShortcut(appinfo_none);
3486 const std::string app_id_landscape = AddArcAppAndShortcut(appinfo_landscape);
3487 const std::string app_id_portrait = AddArcAppAndShortcut(appinfo_portrait);
3488
3489 int32_t task_id_none = 1;
3490 int32_t task_id_landscape = 2;
3491 int32_t task_id_portrait = 3;
3492
3493 // This needs to be kept on stack because window's property has
3494 // refeference to this.
3495 std::string window_app_id_none("org.chromium.arc.1");
3496 std::string window_app_id_landscape("org.chromium.arc.2");
3497 std::string window_app_id_portrait("org.chromium.arc.3");
3498
3499 ash::ScreenOrientationController* controller =
3500 ash::Shell::GetInstance()->screen_orientation_controller();
3501
3502 // Creating a window with NONE orientation will not lock the screen.
3503 views::Widget* window_none = CreateArcWindow(window_app_id_none);
3504 NotifyOnTaskCreated(appinfo_none, task_id_none);
3505 EXPECT_FALSE(controller->rotation_locked());
3506 EXPECT_EQ(display::Display::ROTATE_0,
3507 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3508
3509 // Create a arc window with PORTRAIT orientation locks the screen to 90.
3510 views::Widget* window_portrait = CreateArcWindow(window_app_id_portrait);
3511 NotifyOnTaskCreated(appinfo_portrait, task_id_portrait);
3512 EXPECT_TRUE(controller->rotation_locked());
3513 EXPECT_EQ(display::Display::ROTATE_90,
3514 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3515
3516 // Create a arc window with LANDSCAPE orientation locks the screen to 0.
3517 views::Widget* window_landscape = CreateArcWindow(window_app_id_landscape);
3518 NotifyOnTaskCreated(appinfo_landscape, task_id_landscape);
3519 EXPECT_TRUE(controller->rotation_locked());
3520 EXPECT_EQ(display::Display::ROTATE_0,
3521 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3522
3523 // Activating a window with NON orientation unlocks the screen.
3524 window_none->Activate();
3525 EXPECT_FALSE(controller->rotation_locked());
3526 EXPECT_EQ(display::Display::ROTATE_0,
3527 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3528
3529 // Activating a window with PORTRAIT orientation locks the screen to 90.
3530 window_portrait->Activate();
3531 EXPECT_TRUE(controller->rotation_locked());
3532 EXPECT_EQ(display::Display::ROTATE_90,
3533 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3534
3535 // Disable Tablet mode, and make sure the screen is unlocked.
3536 EnableTabletMode(false);
3537 EXPECT_FALSE(controller->rotation_locked());
3538 EXPECT_EQ(display::Display::ROTATE_0,
3539 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3540
3541 // Re-enable Tablet mode, and make sure the screen is locked to 90.
3542 EnableTabletMode(true);
3543 EXPECT_TRUE(controller->rotation_locked());
3544 EXPECT_EQ(display::Display::ROTATE_90,
3545 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3546
3547 window_portrait->Activate();
3548 EXPECT_TRUE(controller->rotation_locked());
3549 EXPECT_EQ(display::Display::ROTATE_90,
3550 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3551
3552 window_landscape->Activate();
3553 EXPECT_TRUE(controller->rotation_locked());
3554 EXPECT_EQ(display::Display::ROTATE_0,
3555 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3556
3557 // OnTaskOrientationLockRequested can overwrite the current lock.
3558 NotifyOnTaskOrientationLockRequested(task_id_landscape,
3559 OrientationLock::NONE);
3560 EXPECT_FALSE(controller->rotation_locked());
3561 EXPECT_EQ(display::Display::ROTATE_0,
3562 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3563
3564 NotifyOnTaskOrientationLockRequested(task_id_landscape,
3565 OrientationLock::PORTRAIT);
3566 EXPECT_TRUE(controller->rotation_locked());
3567 EXPECT_EQ(display::Display::ROTATE_90,
3568 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3569
3570 // Non active window won't change the lock.
3571 NotifyOnTaskOrientationLockRequested(task_id_none,
3572 OrientationLock::LANDSCAPE);
3573 EXPECT_TRUE(controller->rotation_locked());
3574 EXPECT_EQ(display::Display::ROTATE_90,
3575 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3576
3577 // But activating it will change the locked orinetation.
3578 window_none->Activate();
3579 EXPECT_TRUE(controller->rotation_locked());
3580 EXPECT_EQ(display::Display::ROTATE_0,
3581 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3582
3583 // OnTaskOrientationLockRequested will not lock the screen in non Tablet mode.
3584 EnableTabletMode(false);
3585 EXPECT_FALSE(controller->rotation_locked());
3586 EXPECT_EQ(display::Display::ROTATE_0,
3587 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3588
3589 NotifyOnTaskOrientationLockRequested(task_id_none, OrientationLock::PORTRAIT);
3590 EXPECT_FALSE(controller->rotation_locked());
3591 EXPECT_EQ(display::Display::ROTATE_0,
3592 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3593
3594 // But it remembers the orientation lock and use it when Tablet mode is
3595 // enabled.
3596 EnableTabletMode(true);
3597 EXPECT_TRUE(controller->rotation_locked());
3598 EXPECT_EQ(display::Display::ROTATE_90,
3599 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3600 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698