Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / fullscreen / fullscreen_controller_test.cc
blob51f5f711ce63e3f34bb540e376e2f8a3479e5353
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 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h"
7 #include "base/command_line.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h"
14 #include "content/public/browser/web_contents.h"
15 #include "content/public/test/test_navigation_observer.h"
17 using content::WebContents;
19 const char FullscreenControllerTest::kFullscreenMouseLockHTML[] =
20 "files/fullscreen_mouselock/fullscreen_mouselock.html";
22 void FullscreenControllerTest::RequestToLockMouse(
23 bool user_gesture,
24 bool last_unlocked_by_target) {
25 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
26 browser()->RequestToLockMouse(tab, user_gesture,
27 last_unlocked_by_target);
30 void FullscreenControllerTest::LostMouseLock() {
31 browser()->LostMouseLock();
34 bool FullscreenControllerTest::SendEscapeToFullscreenController() {
35 return browser()->fullscreen_controller()->HandleUserPressedEscape();
38 bool FullscreenControllerTest::IsFullscreenForBrowser() {
39 return browser()->fullscreen_controller()->IsFullscreenForBrowser();
42 bool FullscreenControllerTest::IsFullscreenForTabOrPending() {
43 return browser()->fullscreen_controller()->IsFullscreenForTabOrPending();
46 bool FullscreenControllerTest::IsMouseLockPermissionRequested() {
47 FullscreenExitBubbleType type =
48 browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
49 bool mouse_lock = false;
50 fullscreen_bubble::PermissionRequestedByType(type, NULL, &mouse_lock);
51 return mouse_lock;
54 bool FullscreenControllerTest::IsFullscreenPermissionRequested() {
55 FullscreenExitBubbleType type =
56 browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
57 bool fullscreen = false;
58 fullscreen_bubble::PermissionRequestedByType(type, &fullscreen, NULL);
59 return fullscreen;
62 FullscreenExitBubbleType
63 FullscreenControllerTest::GetFullscreenExitBubbleType() {
64 return browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
67 bool FullscreenControllerTest::IsFullscreenBubbleDisplayed() {
68 FullscreenExitBubbleType type =
69 browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
70 return type != FEB_TYPE_NONE;
73 bool FullscreenControllerTest::IsFullscreenBubbleDisplayingButtons() {
74 FullscreenExitBubbleType type =
75 browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
76 return fullscreen_bubble::ShowButtonsForType(type);
79 void FullscreenControllerTest::AcceptCurrentFullscreenOrMouseLockRequest() {
80 browser()->fullscreen_controller()->OnAcceptFullscreenPermission();
83 void FullscreenControllerTest::DenyCurrentFullscreenOrMouseLockRequest() {
84 browser()->fullscreen_controller()->OnDenyFullscreenPermission();
87 void FullscreenControllerTest::GoBack() {
88 content::TestNavigationObserver observer(
89 browser()->tab_strip_model()->GetActiveWebContents(), 1);
90 chrome::GoBack(browser(), CURRENT_TAB);
91 observer.Wait();
94 void FullscreenControllerTest::Reload() {
95 content::TestNavigationObserver observer(
96 browser()->tab_strip_model()->GetActiveWebContents(), 1);
97 chrome::Reload(browser(), CURRENT_TAB);
98 observer.Wait();
101 void FullscreenControllerTest::SetPrivilegedFullscreen(bool is_privileged) {
102 browser()->fullscreen_controller()->
103 SetPrivilegedFullscreenForTesting(is_privileged);