| 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 "base/command_line.h" |
| 5 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 6 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 7 #include "chrome/browser/fullscreen.h" | 8 #include "chrome/browser/fullscreen.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 11 #include "chrome/browser/ui/browser_commands.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 13 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
| 13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 14 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "chrome/test/base/interactive_test_utils.h" | 16 #include "chrome/test/base/interactive_test_utils.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
| 17 #include "components/content_settings/core/browser/host_content_settings_map.h" | 18 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 18 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/browser/render_widget_host.h" | 20 #include "content/public/browser/render_widget_host.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
| 23 #include "net/test/embedded_test_server/embedded_test_server.h" | 25 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 24 | 26 |
| 25 using url::kAboutBlankURL; | 27 using url::kAboutBlankURL; |
| 26 using content::WebContents; | 28 using content::WebContents; |
| 27 using ui::PAGE_TRANSITION_TYPED; | 29 using ui::PAGE_TRANSITION_TYPED; |
| 28 | 30 |
| 29 namespace { | 31 namespace { |
| 30 | 32 |
| 31 const base::FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("/simple.html"); | 33 const base::FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("/simple.html"); |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 686 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
| 685 | 687 |
| 686 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 688 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
| 687 | 689 |
| 688 // Lock the mouse with a user gesture. | 690 // Lock the mouse with a user gesture. |
| 689 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 691 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
| 690 browser(), ui::VKEY_1, false, false, false, false, | 692 browser(), ui::VKEY_1, false, false, false, false, |
| 691 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 693 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
| 692 content::NotificationService::AllSources())); | 694 content::NotificationService::AllSources())); |
| 693 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 695 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 694 ASSERT_TRUE(IsMouseLockPermissionRequested()); | 696 if (false) { |
| 695 ASSERT_FALSE(IsMouseLocked()); | 697 ASSERT_TRUE(IsMouseLockPermissionRequested()); |
| 698 ASSERT_FALSE(IsMouseLocked()); |
| 696 | 699 |
| 697 // Accept mouse lock. | 700 // Accept mouse lock. |
| 698 AcceptCurrentFullscreenOrMouseLockRequest(); | 701 AcceptCurrentFullscreenOrMouseLockRequest(); |
| 702 } |
| 699 ASSERT_TRUE(IsMouseLocked()); | 703 ASSERT_TRUE(IsMouseLocked()); |
| 700 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 704 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 701 | 705 |
| 702 // Unlock the mouse from target, make sure it's unlocked. | 706 // Unlock the mouse from target, make sure it's unlocked. |
| 703 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 707 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
| 704 browser(), ui::VKEY_U, false, false, false, false, | 708 browser(), ui::VKEY_U, false, false, false, false, |
| 705 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 709 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
| 706 content::NotificationService::AllSources())); | 710 content::NotificationService::AllSources())); |
| 707 ASSERT_FALSE(IsMouseLocked()); | 711 ASSERT_FALSE(IsMouseLocked()); |
| 708 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 712 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 | 960 |
| 957 GURL url = embedded_test_server()->GetURL("/simple.html"); | 961 GURL url = embedded_test_server()->GetURL("/simple.html"); |
| 958 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); | 962 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); |
| 959 | 963 |
| 960 // Validate that going fullscreen for a URL defaults to asking permision. | 964 // Validate that going fullscreen for a URL defaults to asking permision. |
| 961 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 965 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 962 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); | 966 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); |
| 963 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 967 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
| 964 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); | 968 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); |
| 965 } | 969 } |
| OLD | NEW |