1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/ui/browser_window.h"
7 #include "chrome/test/base/ui_test_utils.h"
9 // Window resizes are not completed by the time the callback happens,
10 // so these tests fail on linux/gtk. http://crbug.com/72369
11 #if defined(OS_LINUX) && !defined(USE_AURA)
12 #define MAYBE_FocusWindowDoesNotExitFullscreen \
13 DISABLED_FocusWindowDoesNotExitFullscreen
14 #define MAYBE_UpdateWindowSizeExitsFullscreen \
15 DISABLED_UpdateWindowSizeExitsFullscreen
18 // TODO(linux_aura) http://crbug.com/163931
19 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
20 #define MAYBE_FocusWindowDoesNotExitFullscreen \
21 DISABLED_FocusWindowDoesNotExitFullscreen
23 #define MAYBE_FocusWindowDoesNotExitFullscreen FocusWindowDoesNotExitFullscreen
26 // Fails flakily: http://crbug.com/308041
27 #define MAYBE_UpdateWindowSizeExitsFullscreen DISABLED_UpdateWindowSizeExitsFullscreen
28 #endif // defined(OS_LINUX) && !defined(USE_AURA)
30 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
,
31 ExtensionFullscreenAccessFail
) {
32 // Test that fullscreen can be accessed from an extension without permission.
33 ASSERT_TRUE(RunPlatformAppTest("fullscreen/no_permission")) << message_
;
36 // Disabled, a user gesture is required for fullscreen. http://crbug.com/174178
37 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
,
38 DISABLED_ExtensionFullscreenAccessPass
) {
39 // Test that fullscreen can be accessed from an extension with permission.
40 ASSERT_TRUE(RunPlatformAppTest("fullscreen/has_permission")) << message_
;
43 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
,
44 MAYBE_FocusWindowDoesNotExitFullscreen
) {
45 browser()->window()->EnterFullscreen(
46 GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION
);
47 bool is_fullscreen
= browser()->window()->IsFullscreen();
48 ASSERT_TRUE(RunExtensionTest("window_update/focus")) << message_
;
49 ASSERT_EQ(is_fullscreen
, browser()->window()->IsFullscreen());
52 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
,
53 MAYBE_UpdateWindowSizeExitsFullscreen
) {
54 browser()->window()->EnterFullscreen(
55 GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION
);
56 ASSERT_TRUE(RunExtensionTest("window_update/sizing")) << message_
;
57 ASSERT_FALSE(browser()->window()->IsFullscreen());