| 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_factory.h" |
| 6 #include "chrome/browser/fullscreen.h" | 7 #include "chrome/browser/fullscreen.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 12 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/test/base/interactive_test_utils.h" | 14 #include "chrome/test/base/interactive_test_utils.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "components/content_settings/core/browser/host_content_settings_map.h" | 16 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); | 98 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); |
| 98 | 99 |
| 99 // Validate that going fullscreen for a URL defaults to asking permision. | 100 // Validate that going fullscreen for a URL defaults to asking permision. |
| 100 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 101 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 101 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | 102 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); |
| 102 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 103 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
| 103 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(false)); | 104 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(false)); |
| 104 | 105 |
| 105 // Add content setting to ALLOW fullscreen. | 106 // Add content setting to ALLOW fullscreen. |
| 106 HostContentSettingsMap* settings_map = | 107 HostContentSettingsMap* settings_map = |
| 107 browser()->profile()->GetHostContentSettingsMap(); | 108 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); |
| 108 ContentSettingsPattern pattern = | 109 ContentSettingsPattern pattern = |
| 109 ContentSettingsPattern::FromURL(url); | 110 ContentSettingsPattern::FromURL(url); |
| 110 settings_map->SetContentSetting( | 111 settings_map->SetContentSetting( |
| 111 pattern, ContentSettingsPattern::Wildcard(), | 112 pattern, ContentSettingsPattern::Wildcard(), |
| 112 CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string(), | 113 CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string(), |
| 113 CONTENT_SETTING_ALLOW); | 114 CONTENT_SETTING_ALLOW); |
| 114 | 115 |
| 115 // Now, fullscreen should not prompt for permission. | 116 // Now, fullscreen should not prompt for permission. |
| 116 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 117 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 117 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | 118 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 920 |
| 920 GURL url = test_server()->GetURL("simple.html"); | 921 GURL url = test_server()->GetURL("simple.html"); |
| 921 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); | 922 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); |
| 922 | 923 |
| 923 // Validate that going fullscreen for a URL defaults to asking permision. | 924 // Validate that going fullscreen for a URL defaults to asking permision. |
| 924 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 925 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 925 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); | 926 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); |
| 926 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 927 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
| 927 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); | 928 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); |
| 928 } | 929 } |
| OLD | NEW |