15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_TEST_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_TEST_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 87dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "chrome/browser/chrome_notification_types.h" 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/test/base/in_process_browser_test.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_service.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/test/test_utils.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Observer for NOTIFICATION_FULLSCREEN_CHANGED notifications. 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FullscreenNotificationObserver 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) : public content::WindowedNotificationObserver { 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FullscreenNotificationObserver() : WindowedNotificationObserver( 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) chrome::NOTIFICATION_FULLSCREEN_CHANGED, 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) content::NotificationService::AllSources()) {} 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(FullscreenNotificationObserver); 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Observer for NOTIFICATION_MOUSE_LOCK_CHANGED notifications. 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MouseLockNotificationObserver 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) : public content::WindowedNotificationObserver { 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) MouseLockNotificationObserver() : WindowedNotificationObserver( 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) content::NotificationService::AllSources()) {} 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(MouseLockNotificationObserver); 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Test fixture with convenience functions for fullscreen and mouse lock. 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FullscreenControllerTest : public InProcessBrowserTest { 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FullscreenControllerTest() {} 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void RequestToLockMouse(bool user_gesture, 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool last_unlocked_by_target); 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void LostMouseLock(); 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool SendEscapeToFullscreenController(); 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsFullscreenForBrowser(); 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsFullscreenForTabOrPending(); 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsMouseLockPermissionRequested(); 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsFullscreenPermissionRequested(); 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FullscreenExitBubbleType GetFullscreenExitBubbleType(); 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsFullscreenBubbleDisplayed(); 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsFullscreenBubbleDisplayingButtons(); 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void AcceptCurrentFullscreenOrMouseLockRequest(); 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void DenyCurrentFullscreenOrMouseLockRequest(); 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void GoBack(); 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void Reload(); 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static const char kFullscreenMouseLockHTML[]; 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ToggleTabFullscreen_Internal(bool enter_fullscreen, 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool retry_until_success); 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(FullscreenControllerTest); 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_TEST_H_ 64