Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / ui / exclusive_access / fullscreen_controller_test.cc
blob335892b4136cc1e7d7712700d5811bb7abad87b1
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/exclusive_access/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/exclusive_access/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 FullscreenController* FullscreenControllerTest::GetFullscreenController() {
31 return GetExclusiveAccessManager()->fullscreen_controller();
34 ExclusiveAccessManager* FullscreenControllerTest::GetExclusiveAccessManager() {
35 return browser()->exclusive_access_manager();
38 void FullscreenControllerTest::LostMouseLock() {
39 browser()->LostMouseLock();
42 bool FullscreenControllerTest::SendEscapeToFullscreenController() {
43 return GetExclusiveAccessManager()->HandleUserPressedEscape();
46 bool FullscreenControllerTest::IsFullscreenForBrowser() {
47 return GetFullscreenController()->IsFullscreenForBrowser();
50 bool FullscreenControllerTest::IsWindowFullscreenForTabOrPending() {
51 return GetFullscreenController()->IsWindowFullscreenForTabOrPending();
54 bool FullscreenControllerTest::IsMouseLockPermissionRequested() {
55 ExclusiveAccessBubbleType type = GetExclusiveAccessBubbleType();
56 bool mouse_lock = false;
57 exclusive_access_bubble::PermissionRequestedByType(type, NULL, &mouse_lock);
58 return mouse_lock;
61 bool FullscreenControllerTest::IsFullscreenPermissionRequested() {
62 ExclusiveAccessBubbleType type = GetExclusiveAccessBubbleType();
63 bool fullscreen = false;
64 exclusive_access_bubble::PermissionRequestedByType(type, &fullscreen, NULL);
65 return fullscreen;
68 ExclusiveAccessBubbleType
69 FullscreenControllerTest::GetExclusiveAccessBubbleType() {
70 return GetExclusiveAccessManager()->GetExclusiveAccessExitBubbleType();
73 bool FullscreenControllerTest::IsFullscreenBubbleDisplayed() {
74 return GetExclusiveAccessBubbleType() != EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE;
77 bool FullscreenControllerTest::IsFullscreenBubbleDisplayingButtons() {
78 return exclusive_access_bubble::ShowButtonsForType(
79 GetExclusiveAccessBubbleType());
82 void FullscreenControllerTest::AcceptCurrentFullscreenOrMouseLockRequest() {
83 GetExclusiveAccessManager()->OnAcceptExclusiveAccessPermission();
86 void FullscreenControllerTest::DenyCurrentFullscreenOrMouseLockRequest() {
87 GetExclusiveAccessManager()->OnDenyExclusiveAccessPermission();
90 void FullscreenControllerTest::GoBack() {
91 content::TestNavigationObserver observer(
92 browser()->tab_strip_model()->GetActiveWebContents(), 1);
93 chrome::GoBack(browser(), CURRENT_TAB);
94 observer.Wait();
97 void FullscreenControllerTest::Reload() {
98 content::TestNavigationObserver observer(
99 browser()->tab_strip_model()->GetActiveWebContents(), 1);
100 chrome::Reload(browser(), CURRENT_TAB);
101 observer.Wait();
104 void FullscreenControllerTest::SetPrivilegedFullscreen(bool is_privileged) {
105 GetFullscreenController()->SetPrivilegedFullscreenForTesting(is_privileged);