| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
| 9 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 9 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" | 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 enum WindowState { | 29 enum WindowState { |
| 30 NORMAL, | 30 NORMAL, |
| 31 FULLSCREEN, | 31 FULLSCREEN, |
| 32 // No TO_ state for METRO_SNAP, the windows implementation is synchronous. | 32 // No TO_ state for METRO_SNAP, the windows implementation is synchronous. |
| 33 METRO_SNAP, | 33 METRO_SNAP, |
| 34 TO_NORMAL, | 34 TO_NORMAL, |
| 35 TO_FULLSCREEN, | 35 TO_FULLSCREEN, |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 FullscreenControllerTestWindow(); | 38 FullscreenControllerTestWindow(); |
| 39 virtual ~FullscreenControllerTestWindow() {} | 39 ~FullscreenControllerTestWindow() override {} |
| 40 | 40 |
| 41 // BrowserWindow Interface: | 41 // BrowserWindow Interface: |
| 42 virtual void EnterFullscreen(const GURL& url, | 42 void EnterFullscreen(const GURL& url, FullscreenExitBubbleType type) override; |
| 43 FullscreenExitBubbleType type) override; | 43 void ExitFullscreen() override; |
| 44 virtual void ExitFullscreen() override; | 44 bool ShouldHideUIForFullscreen() const override; |
| 45 virtual bool ShouldHideUIForFullscreen() const override; | 45 bool IsFullscreen() const override; |
| 46 virtual bool IsFullscreen() const override; | |
| 47 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 48 virtual void SetMetroSnapMode(bool enable) override; | 47 virtual void SetMetroSnapMode(bool enable) override; |
| 49 virtual bool IsInMetroSnapMode() const override; | 48 virtual bool IsInMetroSnapMode() const override; |
| 50 #endif | 49 #endif |
| 51 #if defined(OS_MACOSX) | 50 #if defined(OS_MACOSX) |
| 52 virtual void EnterFullscreenWithChrome() override; | 51 void EnterFullscreenWithChrome() override; |
| 53 virtual void EnterFullscreenWithoutChrome() override; | 52 void EnterFullscreenWithoutChrome() override; |
| 54 virtual bool IsFullscreenWithChrome() override; | 53 bool IsFullscreenWithChrome() override; |
| 55 virtual bool IsFullscreenWithoutChrome() override; | 54 bool IsFullscreenWithoutChrome() override; |
| 56 #endif | 55 #endif |
| 57 | 56 |
| 58 static const char* GetWindowStateString(WindowState state); | 57 static const char* GetWindowStateString(WindowState state); |
| 59 WindowState state() const { return state_; } | 58 WindowState state() const { return state_; } |
| 60 void set_browser(Browser* browser) { browser_ = browser; } | 59 void set_browser(Browser* browser) { browser_ = browser; } |
| 61 | 60 |
| 62 // Simulates the window changing state. | 61 // Simulates the window changing state. |
| 63 void ChangeWindowFullscreenState(); | 62 void ChangeWindowFullscreenState(); |
| 64 | 63 |
| 65 private: | 64 private: |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 211 |
| 213 // Unit test fixture testing Fullscreen Controller through its states. Most of | 212 // Unit test fixture testing Fullscreen Controller through its states. Most of |
| 214 // the test logic comes from FullscreenControllerStateTest. | 213 // the test logic comes from FullscreenControllerStateTest. |
| 215 class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest, | 214 class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest, |
| 216 public FullscreenControllerStateTest { | 215 public FullscreenControllerStateTest { |
| 217 public: | 216 public: |
| 218 FullscreenControllerStateUnitTest(); | 217 FullscreenControllerStateUnitTest(); |
| 219 | 218 |
| 220 // FullscreenControllerStateTest: | 219 // FullscreenControllerStateTest: |
| 221 virtual void SetUp() override; | 220 virtual void SetUp() override; |
| 222 virtual BrowserWindow* CreateBrowserWindow() override; | 221 BrowserWindow* CreateBrowserWindow() override; |
| 223 virtual void ChangeWindowFullscreenState() override; | 222 void ChangeWindowFullscreenState() override; |
| 224 virtual const char* GetWindowStateString() override; | 223 const char* GetWindowStateString() override; |
| 225 virtual void VerifyWindowState() override; | 224 void VerifyWindowState() override; |
| 226 | 225 |
| 227 protected: | 226 protected: |
| 228 // FullscreenControllerStateTest: | 227 // FullscreenControllerStateTest: |
| 229 virtual bool ShouldSkipStateAndEventPair(State state, Event event) override; | 228 bool ShouldSkipStateAndEventPair(State state, Event event) override; |
| 230 virtual Browser* GetBrowser() override; | 229 Browser* GetBrowser() override; |
| 231 FullscreenControllerTestWindow* window_; | 230 FullscreenControllerTestWindow* window_; |
| 232 }; | 231 }; |
| 233 | 232 |
| 234 FullscreenControllerStateUnitTest::FullscreenControllerStateUnitTest () | 233 FullscreenControllerStateUnitTest::FullscreenControllerStateUnitTest () |
| 235 : window_(NULL) { | 234 : window_(NULL) { |
| 236 } | 235 } |
| 237 | 236 |
| 238 void FullscreenControllerStateUnitTest::SetUp() { | 237 void FullscreenControllerStateUnitTest::SetUp() { |
| 239 BrowserWithTestWindowTest::SetUp(); | 238 BrowserWithTestWindowTest::SetUp(); |
| 240 window_->set_browser(browser()); | 239 window_->set_browser(browser()); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 786 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
| 788 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); | 787 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); |
| 789 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); | 788 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); |
| 790 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); | 789 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); |
| 791 EXPECT_FALSE(second_browser->fullscreen_controller()-> | 790 EXPECT_FALSE(second_browser->fullscreen_controller()-> |
| 792 IsWindowFullscreenForTabOrPending()); | 791 IsWindowFullscreenForTabOrPending()); |
| 793 | 792 |
| 794 // Required tear-down specific to this test. | 793 // Required tear-down specific to this test. |
| 795 second_browser->tab_strip_model()->CloseAllTabs(); | 794 second_browser->tab_strip_model()->CloseAllTabs(); |
| 796 } | 795 } |
| OLD | NEW |