Make castv2 performance test work.
[chromium-blink-merge.git] / chrome / browser / apps / app_pointer_lock_interactive_uitest.cc
blob5daf2fc090f2500f2f206582a30a143452600309
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/ui/extensions/application_launch.h"
7 #include "chrome/test/base/interactive_test_utils.h"
8 #include "extensions/test/extension_test_message_listener.h"
9 #include "extensions/test/result_catcher.h"
11 class ExtensionPointerLockTest : public extensions::PlatformAppBrowserTest {
12 public:
13 bool RunExtensionPointerLockTest(const char* app_path) {
14 ExtensionTestMessageListener launched_listener("Launched", true);
15 LoadAndLaunchPlatformApp(app_path, &launched_listener);
17 extensions::ResultCatcher catcher;
19 if (!ui_test_utils::ShowAndFocusNativeWindow(
20 GetFirstAppWindow()->GetNativeWindow())) {
21 message_ = "Can't focus window";
22 return false;
25 launched_listener.Reply("");
27 if (!catcher.GetNextResult()) {
28 message_ = catcher.message();
29 return false;
32 return true;
36 IN_PROC_BROWSER_TEST_F(ExtensionPointerLockTest,
37 ExtensionPointerLockAccessFail) {
38 // Test that pointer lock cannot be accessed from an extension without
39 // permission.
40 ASSERT_TRUE(RunExtensionPointerLockTest("pointer_lock/no_permission"))
41 << message_;
44 IN_PROC_BROWSER_TEST_F(ExtensionPointerLockTest,
45 ExtensionPointerLockAccessPass) {
46 // Test that pointer lock can be accessed from an extension with permission.
47 ASSERT_TRUE(RunExtensionPointerLockTest("pointer_lock/has_permission"))
48 << message_;