OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 5 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "content/public/browser/native_web_keyboard_event.h" | 14 #include "content/public/browser/native_web_keyboard_event.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/test/test_navigation_observer.h" | 16 #include "content/public/test/test_navigation_observer.h" |
17 #include "ui/events/base_event_utils.h" | |
17 #include "ui/events/keycodes/keyboard_codes.h" | 18 #include "ui/events/keycodes/keyboard_codes.h" |
18 | 19 |
19 using content::WebContents; | 20 using content::WebContents; |
20 | 21 |
21 const char FullscreenControllerTest::kFullscreenMouseLockHTML[] = | 22 const char FullscreenControllerTest::kFullscreenMouseLockHTML[] = |
22 "/fullscreen_mouselock/fullscreen_mouselock.html"; | 23 "/fullscreen_mouselock/fullscreen_mouselock.html"; |
23 | 24 |
24 void FullscreenControllerTest::RequestToLockMouse( | 25 void FullscreenControllerTest::RequestToLockMouse( |
25 bool user_gesture, | 26 bool user_gesture, |
26 bool last_unlocked_by_target) { | 27 bool last_unlocked_by_target) { |
(...skipping 12 matching lines...) Expand all Loading... | |
39 | 40 |
40 ExclusiveAccessManager* FullscreenControllerTest::GetExclusiveAccessManager() { | 41 ExclusiveAccessManager* FullscreenControllerTest::GetExclusiveAccessManager() { |
41 return browser()->exclusive_access_manager(); | 42 return browser()->exclusive_access_manager(); |
42 } | 43 } |
43 | 44 |
44 void FullscreenControllerTest::LostMouseLock() { | 45 void FullscreenControllerTest::LostMouseLock() { |
45 browser()->LostMouseLock(); | 46 browser()->LostMouseLock(); |
46 } | 47 } |
47 | 48 |
48 bool FullscreenControllerTest::SendEscapeToFullscreenController() { | 49 bool FullscreenControllerTest::SendEscapeToFullscreenController() { |
49 content::NativeWebKeyboardEvent event; | 50 content::NativeWebKeyboardEvent event(blink::WebInputEvent::KeyDown, |
51 blink::WebInputEvent::NoModifiers, | |
52 ui::EventTimeForNow()); | |
majidvp
2016/12/19 20:09:52
nit: can this be TimeStampForTesting
dtapuska
2016/12/20 19:49:21
Done.
| |
50 event.windowsKeyCode = ui::VKEY_ESCAPE; | 53 event.windowsKeyCode = ui::VKEY_ESCAPE; |
51 return GetExclusiveAccessManager()->HandleUserKeyPress(event); | 54 return GetExclusiveAccessManager()->HandleUserKeyPress(event); |
52 } | 55 } |
53 | 56 |
54 bool FullscreenControllerTest::IsFullscreenForBrowser() { | 57 bool FullscreenControllerTest::IsFullscreenForBrowser() { |
55 return GetFullscreenController()->IsFullscreenForBrowser(); | 58 return GetFullscreenController()->IsFullscreenForBrowser(); |
56 } | 59 } |
57 | 60 |
58 bool FullscreenControllerTest::IsWindowFullscreenForTabOrPending() { | 61 bool FullscreenControllerTest::IsWindowFullscreenForTabOrPending() { |
59 return GetFullscreenController()->IsWindowFullscreenForTabOrPending(); | 62 return GetFullscreenController()->IsWindowFullscreenForTabOrPending(); |
(...skipping 18 matching lines...) Expand all Loading... | |
78 void FullscreenControllerTest::Reload() { | 81 void FullscreenControllerTest::Reload() { |
79 content::TestNavigationObserver observer( | 82 content::TestNavigationObserver observer( |
80 browser()->tab_strip_model()->GetActiveWebContents(), 1); | 83 browser()->tab_strip_model()->GetActiveWebContents(), 1); |
81 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); | 84 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
82 observer.Wait(); | 85 observer.Wait(); |
83 } | 86 } |
84 | 87 |
85 void FullscreenControllerTest::SetPrivilegedFullscreen(bool is_privileged) { | 88 void FullscreenControllerTest::SetPrivilegedFullscreen(bool is_privileged) { |
86 GetFullscreenController()->SetPrivilegedFullscreenForTesting(is_privileged); | 89 GetFullscreenController()->SetPrivilegedFullscreenForTesting(is_privileged); |
87 } | 90 } |
OLD | NEW |