OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "chrome/browser/content_settings/host_content_settings_map.h" | 6 #include "chrome/browser/content_settings/host_content_settings_map.h" |
7 #include "chrome/browser/fullscreen.h" | 7 #include "chrome/browser/fullscreen.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 ASSERT_FALSE(IsMouseLocked()); | 618 ASSERT_FALSE(IsMouseLocked()); |
619 ASSERT_TRUE(IsFullscreenForTabOrPending()); | 619 ASSERT_TRUE(IsFullscreenForTabOrPending()); |
620 | 620 |
621 // Accept both, confirm they are enabled and there is no prompt. | 621 // Accept both, confirm they are enabled and there is no prompt. |
622 AcceptCurrentFullscreenOrMouseLockRequest(); | 622 AcceptCurrentFullscreenOrMouseLockRequest(); |
623 ASSERT_TRUE(IsMouseLocked()); | 623 ASSERT_TRUE(IsMouseLocked()); |
624 ASSERT_TRUE(IsFullscreenForTabOrPending()); | 624 ASSERT_TRUE(IsFullscreenForTabOrPending()); |
625 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 625 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
626 } | 626 } |
627 | 627 |
| 628 // Tests mouse lock and fullscreen for the privileged fullscreen case (e.g., |
| 629 // embedded flash fullscreen, since the Flash plugin handles user permissions |
| 630 // requests itself). |
| 631 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
| 632 PrivilegedMouseLockAndFullscreen) { |
| 633 ASSERT_TRUE(test_server()->Start()); |
| 634 ui_test_utils::NavigateToURL(browser(), |
| 635 test_server()->GetURL(kFullscreenMouseLockHTML)); |
| 636 |
| 637 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
| 638 |
| 639 SetPrivilegedFullscreen(true); |
| 640 |
| 641 // Request to lock the mouse and enter fullscreen. |
| 642 FullscreenNotificationObserver fullscreen_observer; |
| 643 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
| 644 browser(), ui::VKEY_B, false, true, false, false, |
| 645 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
| 646 content::NotificationService::AllSources())); |
| 647 fullscreen_observer.Wait(); |
| 648 |
| 649 // Confirm they are enabled and there is no prompt. |
| 650 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 651 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 652 ASSERT_FALSE(IsMouseLockPermissionRequested()); |
| 653 ASSERT_TRUE(IsMouseLocked()); |
| 654 ASSERT_TRUE(IsFullscreenForTabOrPending()); |
| 655 } |
| 656 |
628 // Tests mouse lock can be exited and re-entered by an application silently | 657 // Tests mouse lock can be exited and re-entered by an application silently |
629 // with no UI distraction for users. | 658 // with no UI distraction for users. |
630 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 659 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
631 MouseLockSilentAfterTargetUnlock) { | 660 MouseLockSilentAfterTargetUnlock) { |
632 ASSERT_TRUE(test_server()->Start()); | 661 ASSERT_TRUE(test_server()->Start()); |
633 ui_test_utils::NavigateToURL(browser(), | 662 ui_test_utils::NavigateToURL(browser(), |
634 test_server()->GetURL(kFullscreenMouseLockHTML)); | 663 test_server()->GetURL(kFullscreenMouseLockHTML)); |
635 | 664 |
636 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 665 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
637 | 666 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 | 905 |
877 GURL url = test_server()->GetURL("simple.html"); | 906 GURL url = test_server()->GetURL("simple.html"); |
878 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); | 907 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); |
879 | 908 |
880 // Validate that going fullscreen for a URL defaults to asking permision. | 909 // Validate that going fullscreen for a URL defaults to asking permision. |
881 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 910 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
882 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); | 911 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); |
883 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 912 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
884 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); | 913 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); |
885 } | 914 } |
OLD | NEW |