summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-17 23:03:10 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-17 23:03:10 +0000
commit936e85963a6d11c79c7ea774bc41c8729c04693f (patch)
tree977c0c15dac21cc826df835f5a69ba2a2baf8215 /chrome/browser
parentbc6431ccc1c076a404a6aa6747ed8183f4e0943e (diff)
downloadchromium_src-936e85963a6d11c79c7ea774bc41c8729c04693f.zip
chromium_src-936e85963a6d11c79c7ea774bc41c8729c04693f.tar.gz
chromium_src-936e85963a6d11c79c7ea774bc41c8729c04693f.tar.bz2
Add app.window.shape permission to control access to setShape.
This adds an 'app.window.shape' permission that needs to be added to the platform app's manifest to enable the setShape API. This CL also moves fullscreen, overrideEscFullscreen and alwaysOnTopWindow permissions into the same app.window namespace as the window shape permission. Aliases from the old permission names are included for backward compat. BUG= R=kalman@chromium.org, meacer@chromium.org Review URL: https://codereview.chromium.org/100423002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/apps/app_window_interactive_uitest.cc52
-rw-r--r--chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc2
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_apitest.cc7
3 files changed, 60 insertions, 1 deletions
diff --git a/chrome/browser/apps/app_window_interactive_uitest.cc b/chrome/browser/apps/app_window_interactive_uitest.cc
index 5b79947..0c90e44 100644
--- a/chrome/browser/apps/app_window_interactive_uitest.cc
+++ b/chrome/browser/apps/app_window_interactive_uitest.cc
@@ -275,6 +275,58 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
EXPECT_TRUE(GetFirstAppWindow()->GetBaseWindow()->IsFullscreen());
}
+// This test is duplicated from ESCDoesNotLeaveFullscreenWindow.
+// It runs the same test, but uses the old permission names: 'fullscreen'
+// and 'overrideEscFullscreen'.
+IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
+ ESCDoesNotLeaveFullscreenOldPermission) {
+// This test is flaky on MacOS 10.6.
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ if (base::mac::IsOSSnowLeopard())
+ return;
+#endif
+
+ ExtensionTestMessageListener launched_listener("Launched", true);
+ LoadAndLaunchPlatformApp("prevent_leave_fullscreen_old");
+ ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+
+ // We start by making sure the window is actually focused.
+ ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
+ GetFirstAppWindow()->GetNativeWindow()));
+
+ // When receiving the reply, the application will try to go fullscreen using
+ // the Window API but there is no synchronous way to know if that actually
+ // succeeded. Also, failure will not be notified. A failure case will only be
+ // known with a timeout.
+ {
+ FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow());
+
+ launched_listener.Reply("window");
+
+ fs_changed.Wait();
+ }
+
+ // Depending on the platform, going fullscreen might create an animation.
+ // We want to make sure that the ESC key we will send next is actually going
+ // to be received and the application might not receive key events during the
+ // animation so we should wait for the key focus to be back.
+ WaitUntilKeyFocus();
+
+ ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE));
+
+ ExtensionTestMessageListener second_key_listener("B_KEY_RECEIVED", false);
+
+ ASSERT_TRUE(SimulateKeyPress(ui::VKEY_B));
+
+ ASSERT_TRUE(second_key_listener.WaitUntilSatisfied());
+
+ // We assume that at that point, if we had to leave fullscreen, we should be.
+ // However, by nature, we can not guarantee that and given that we do test
+ // that nothing happens, we might end up with random-success when the feature
+ // is broken.
+ EXPECT_TRUE(GetFirstAppWindow()->GetBaseWindow()->IsFullscreen());
+}
+
// This test does not work on Linux Aura because ShowInactive() is not
// implemented. See http://crbug.com/325142
// It also does not work on Windows because of the document being focused even
diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
index 0cf6ef0..2277942 100644
--- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
+++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
@@ -49,7 +49,7 @@ const char kRequiresFramelessWindow[] =
"This function requires a frameless window (frame:none).";
const char kAlwaysOnTopPermission[] =
- "The \"alwaysOnTopWindows\" permission is required.";
+ "The \"app.window.alwaysOnTop\" permission is required.";
const char kInvalidParameters[] = "Invalid parameters.";
diff --git a/chrome/browser/extensions/api/app_window/app_window_apitest.cc b/chrome/browser/extensions/api/app_window/app_window_apitest.cc
index 99a5c02..5866c19 100644
--- a/chrome/browser/extensions/api/app_window/app_window_apitest.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_apitest.cc
@@ -142,6 +142,13 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
+ WindowsApiAlwaysOnTopWithOldPermissions) {
+ EXPECT_TRUE(RunPlatformAppTest(
+ "platform_apps/windows_api_always_on_top/has_old_permissions"))
+ << message_;
+}
+
+IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
WindowsApiAlwaysOnTopNoPermissions) {
EXPECT_TRUE(RunPlatformAppTest(
"platform_apps/windows_api_always_on_top/no_permissions")) << message_;