1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_TEST_H_
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_TEST_H_
8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "content/public/browser/notification_service.h"
13 #include "content/public/test/test_utils.h"
15 // Observer for NOTIFICATION_FULLSCREEN_CHANGED notifications.
16 class FullscreenNotificationObserver
17 : public content::WindowedNotificationObserver
{
19 FullscreenNotificationObserver() : WindowedNotificationObserver(
20 chrome::NOTIFICATION_FULLSCREEN_CHANGED
,
21 content::NotificationService::AllSources()) {}
23 DISALLOW_COPY_AND_ASSIGN(FullscreenNotificationObserver
);
26 // Observer for NOTIFICATION_MOUSE_LOCK_CHANGED notifications.
27 class MouseLockNotificationObserver
28 : public content::WindowedNotificationObserver
{
30 MouseLockNotificationObserver() : WindowedNotificationObserver(
31 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED
,
32 content::NotificationService::AllSources()) {}
34 DISALLOW_COPY_AND_ASSIGN(MouseLockNotificationObserver
);
37 // Test fixture with convenience functions for fullscreen and mouse lock.
38 class FullscreenControllerTest
: public InProcessBrowserTest
{
40 FullscreenControllerTest() {}
42 void RequestToLockMouse(bool user_gesture
,
43 bool last_unlocked_by_target
);
45 bool SendEscapeToFullscreenController();
46 bool IsFullscreenForBrowser();
47 bool IsWindowFullscreenForTabOrPending();
48 bool IsMouseLockPermissionRequested();
49 bool IsFullscreenPermissionRequested();
50 ExclusiveAccessBubbleType
GetExclusiveAccessBubbleType();
51 bool IsFullscreenBubbleDisplayed();
52 bool IsFullscreenBubbleDisplayingButtons();
53 void AcceptCurrentFullscreenOrMouseLockRequest();
54 void DenyCurrentFullscreenOrMouseLockRequest();
57 void SetPrivilegedFullscreen(bool is_privileged
);
58 static const char kFullscreenMouseLockHTML
[];
59 FullscreenController
* GetFullscreenController();
60 ExclusiveAccessManager
* GetExclusiveAccessManager();
63 void ToggleTabFullscreen_Internal(bool enter_fullscreen
,
64 bool retry_until_success
);
65 DISALLOW_COPY_AND_ASSIGN(FullscreenControllerTest
);
68 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_TEST_H_