Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / apps / app_pointer_lock_interactive_uitest.cc
blobf849c81c70323a53a19c69acef94229aa7920791
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);
15 if (!launched_listener.WaitUntilSatisfied()) {
16 message_ = "Did not get the 'Launched' message.";
17 return false;
20 ResultCatcher catcher;
22 if (!ui_test_utils::ShowAndFocusNativeWindow(
23 GetFirstShellWindow()->GetNativeWindow())) {
24 message_ = "Can't focus window";
25 return false;
28 launched_listener.Reply("");
30 if (!catcher.GetNextResult()) {
31 message_ = catcher.message();
32 return false;
35 return true;
39 IN_PROC_BROWSER_TEST_F(ExtensionPointerLockTest,
40 ExtensionPointerLockAccessFail) {
41 // Test that pointer lock cannot be accessed from an extension without
42 // permission.
43 ASSERT_TRUE(RunExtensionPointerLockTest("pointer_lock/no_permission"))
44 << message_;
47 IN_PROC_BROWSER_TEST_F(ExtensionPointerLockTest,
48 ExtensionPointerLockAccessPass) {
49 // Test that pointer lock can be accessed from an extension with permission.
50 ASSERT_TRUE(RunExtensionPointerLockTest("pointer_lock/has_permission"))
51 << message_;