Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / chrome / browser / apps / app_pointer_lock_interactive_uitest.cc
blobb514cc55f12f6989ef6b574acebaea85916e00c7
1 // Copyright 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/apps/app_browsertest_util.h"
6 #include "chrome/browser/extensions/extension_test_message_listener.h"
7 #include "chrome/browser/ui/extensions/application_launch.h"
8 #include "chrome/test/base/interactive_test_utils.h"
10 class ExtensionPointerLockTest : public extensions::PlatformAppBrowserTest {
11 public:
12 bool RunExtensionPointerLockTest(const char* app_path) {
13 ExtensionTestMessageListener launched_listener("Launched", true);
14 LoadAndLaunchPlatformApp(app_path, &launched_listener);
16 ResultCatcher catcher;
18 if (!ui_test_utils::ShowAndFocusNativeWindow(
19 GetFirstAppWindow()->GetNativeWindow())) {
20 message_ = "Can't focus window";
21 return false;
24 launched_listener.Reply("");
26 if (!catcher.GetNextResult()) {
27 message_ = catcher.message();
28 return false;
31 return true;
35 IN_PROC_BROWSER_TEST_F(ExtensionPointerLockTest,
36 ExtensionPointerLockAccessFail) {
37 // Test that pointer lock cannot be accessed from an extension without
38 // permission.
39 ASSERT_TRUE(RunExtensionPointerLockTest("pointer_lock/no_permission"))
40 << message_;
43 IN_PROC_BROWSER_TEST_F(ExtensionPointerLockTest,
44 ExtensionPointerLockAccessPass) {
45 // Test that pointer lock can be accessed from an extension with permission.
46 ASSERT_TRUE(RunExtensionPointerLockTest("pointer_lock/has_permission"))
47 << message_;