Chromium Code Reviews| 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/fullscreen_controller_test.h" | 5 #include "chrome/browser/ui/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_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "chrome/browser/ui/fullscreen_controller.h" | 10 #include "chrome/browser/ui/fullscreen_controller.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/test/test_navigation_observer.h" | |
| 13 | 14 |
| 14 using content::WebContents; | 15 using content::WebContents; |
| 15 | 16 |
| 16 const char FullscreenControllerTest::kFullscreenMouseLockHTML[] = | 17 const char FullscreenControllerTest::kFullscreenMouseLockHTML[] = |
| 17 "files/fullscreen_mouselock/fullscreen_mouselock.html"; | 18 "files/fullscreen_mouselock/fullscreen_mouselock.html"; |
| 18 | 19 |
| 19 void FullscreenControllerTest::SetUpCommandLine(CommandLine* command_line) { | 20 void FullscreenControllerTest::SetUpCommandLine(CommandLine* command_line) { |
| 20 InProcessBrowserTest::SetUpCommandLine(command_line); | 21 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 21 command_line->AppendSwitch(switches::kEnablePointerLock); | 22 command_line->AppendSwitch(switches::kEnablePointerLock); |
| 22 } | 23 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 FullscreenExitBubbleType type = | 108 FullscreenExitBubbleType type = |
| 108 browser()->fullscreen_controller_->GetFullscreenExitBubbleType(); | 109 browser()->fullscreen_controller_->GetFullscreenExitBubbleType(); |
| 109 browser()->OnAcceptFullscreenPermission(fullscreen_tab->GetURL(), type); | 110 browser()->OnAcceptFullscreenPermission(fullscreen_tab->GetURL(), type); |
| 110 } | 111 } |
| 111 | 112 |
| 112 void FullscreenControllerTest::DenyCurrentFullscreenOrMouseLockRequest() { | 113 void FullscreenControllerTest::DenyCurrentFullscreenOrMouseLockRequest() { |
| 113 FullscreenExitBubbleType type = | 114 FullscreenExitBubbleType type = |
| 114 browser()->fullscreen_controller_->GetFullscreenExitBubbleType(); | 115 browser()->fullscreen_controller_->GetFullscreenExitBubbleType(); |
| 115 browser()->OnDenyFullscreenPermission(type); | 116 browser()->OnDenyFullscreenPermission(type); |
| 116 } | 117 } |
| 118 | |
| 119 void FullscreenControllerTest::AddTabAtIndexAndWait(int index, const GURL& url, | |
| 120 content::PageTransition transition) { | |
| 121 content::TestNavigationObserver observer( | |
| 122 content::NotificationService::AllSources(), NULL, 1); | |
| 123 | |
| 124 AddTabAtIndex(index, url, transition); | |
| 125 | |
| 126 observer.WaitForObservation( | |
|
scheib
2012/06/18 23:08:07
Why not just observer.Wait()?
koz (OOO until 15th September)
2012/06/19 00:45:56
Ah, that's much nicer! The dangers of cargo cultin
| |
| 127 base::Bind(&ui_test_utils::RunMessageLoop), | |
| 128 base::Bind(&MessageLoop::Quit, | |
| 129 base::Unretained(MessageLoopForUI::current()))); | |
| 130 } | |
| 131 | |
| 132 void FullscreenControllerTest::GoBack() { | |
| 133 content::TestNavigationObserver observer( | |
| 134 content::NotificationService::AllSources(), NULL, 1); | |
| 135 | |
| 136 browser()->GoBack(CURRENT_TAB); | |
| 137 | |
| 138 observer.WaitForObservation( | |
| 139 base::Bind(&ui_test_utils::RunMessageLoop), | |
| 140 base::Bind(&MessageLoop::Quit, | |
| 141 base::Unretained(MessageLoopForUI::current()))); | |
| 142 } | |
| 143 | |
| 144 void FullscreenControllerTest::Reload() { | |
| 145 content::TestNavigationObserver observer( | |
| 146 content::NotificationService::AllSources(), NULL, 1); | |
| 147 | |
| 148 browser()->Reload(CURRENT_TAB); | |
| 149 | |
| 150 observer.WaitForObservation( | |
| 151 base::Bind(&ui_test_utils::RunMessageLoop), | |
| 152 base::Bind(&MessageLoop::Quit, | |
| 153 base::Unretained(MessageLoopForUI::current()))); | |
| 154 } | |
| OLD | NEW |