Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2999)

Unified Diff: chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc

Issue 12018007: Refactor BrowserWindow fullscreen and presentation on Mac to be consistent with other platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge TOT Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
index 791a9dc7b5c32a7f7bfd7339e49891cfb6028315..92695b42508335baeef9a54d073e95c127c23e82 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
@@ -51,11 +51,9 @@ class FullscreenControllerTestWindow : public TestBrowserWindow {
virtual bool IsInMetroSnapMode() const OVERRIDE;
#endif
#if defined(OS_MACOSX)
- virtual void EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) OVERRIDE;
- virtual void ExitPresentationMode() OVERRIDE;
- virtual bool InPresentationMode() OVERRIDE;
+ virtual void EnterFullscreenWithChrome() OVERRIDE;
+ virtual bool IsFullscreenWithChrome() OVERRIDE;
+ virtual bool IsFullscreenWithoutChrome() OVERRIDE;
#endif
static const char* GetWindowStateString(WindowState state);
@@ -71,7 +69,7 @@ class FullscreenControllerTestWindow : public TestBrowserWindow {
private:
WindowState state_;
- bool mac_presentation_mode_;
+ bool mac_with_chrome_mode_;
Browser* browser_;
// Causes reentrant calls to be made by calling
@@ -82,7 +80,7 @@ class FullscreenControllerTestWindow : public TestBrowserWindow {
FullscreenControllerTestWindow::FullscreenControllerTestWindow()
: state_(NORMAL),
- mac_presentation_mode_(false),
+ mac_with_chrome_mode_(false),
browser_(NULL),
reentrant_(false) {
}
@@ -93,6 +91,7 @@ void FullscreenControllerTestWindow::EnterFullscreen(
}
void FullscreenControllerTestWindow::EnterFullscreen() {
+ mac_with_chrome_mode_ = false;
if (!IsFullscreen()) {
state_ = TO_FULLSCREEN;
ChangeWindowFullscreenStateIfReentrant();
@@ -102,7 +101,7 @@ void FullscreenControllerTestWindow::EnterFullscreen() {
void FullscreenControllerTestWindow::ExitFullscreen() {
if (IsFullscreen()) {
state_ = TO_NORMAL;
- mac_presentation_mode_ = false;
+ mac_with_chrome_mode_ = false;
ChangeWindowFullscreenStateIfReentrant();
}
}
@@ -132,22 +131,17 @@ bool FullscreenControllerTestWindow::IsInMetroSnapMode() const {
#endif
#if defined(OS_MACOSX)
-void FullscreenControllerTestWindow::EnterPresentationMode(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) {
- mac_presentation_mode_ = true;
+void FullscreenControllerTestWindow::EnterFullscreenWithChrome() {
EnterFullscreen();
+ mac_with_chrome_mode_ = true;
}
-void FullscreenControllerTestWindow::ExitPresentationMode() {
- if (InPresentationMode()) {
- mac_presentation_mode_ = false;
- ExitFullscreen();
- }
+bool FullscreenControllerTestWindow::IsFullscreenWithChrome() {
+ return IsFullscreen() && mac_with_chrome_mode_;
}
-bool FullscreenControllerTestWindow::InPresentationMode() {
- return mac_presentation_mode_;
+bool FullscreenControllerTestWindow::IsFullscreenWithoutChrome() {
+ return IsFullscreen() && !mac_with_chrome_mode_;
}
#endif
@@ -317,6 +311,20 @@ Browser* FullscreenControllerStateUnitTest::GetBrowser() {
// Tests -----------------------------------------------------------------------
+#define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \
+ TEST_F(FullscreenControllerStateUnitTest, \
+ state##__##event##reentrant_id) { \
+ AddTab(browser(), GURL(chrome::kAboutBlankURL)); \
+ ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \
+ << GetAndClearDebugLog(); \
+ }
+ // Progress of tests can be examined by inserting the following line:
+ // LOG(INFO) << GetAndClearDebugLog(); }
+
+#define TEST_EVENT(state, event) \
+ TEST_EVENT_INNER(state, event, false, ); \
+ TEST_EVENT_INNER(state, event, true, _Reentrant);
+
// Soak tests:
// Tests all states with all permutations of multiple events to detect lingering
@@ -337,20 +345,6 @@ TEST_F(FullscreenControllerStateUnitTest, TransitionsForEachState) {
// Individual tests for each pair of state and event:
-#define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \
- TEST_F(FullscreenControllerStateUnitTest, \
- state##__##event##reentrant_id) { \
- AddTab(browser(), GURL(chrome::kAboutBlankURL)); \
- ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \
- << GetAndClearDebugLog(); \
- }
- // Progress of tests can be examined by inserting the following line:
- // LOG(INFO) << GetAndClearDebugLog(); }
-
-#define TEST_EVENT(state, event) \
- TEST_EVENT_INNER(state, event, false, ); \
- TEST_EVENT_INNER(state, event, true, _Reentrant);
-
TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN);
TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE);
TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE);
« no previous file with comments | « chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698