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

Side by Side Diff: chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc

Issue 1480183002: Deleted fullscreen virtual methods in BrowserWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More Mac fixes. Created 5 years 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 unified diff | Download patch
OLDNEW
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/exclusive_access/exclusive_access_context.h" 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
(...skipping 23 matching lines...) Expand all
34 // No TO_ state for METRO_SNAP, the windows implementation is synchronous. 34 // No TO_ state for METRO_SNAP, the windows implementation is synchronous.
35 METRO_SNAP, 35 METRO_SNAP,
36 TO_NORMAL, 36 TO_NORMAL,
37 TO_FULLSCREEN, 37 TO_FULLSCREEN,
38 }; 38 };
39 39
40 FullscreenControllerTestWindow(); 40 FullscreenControllerTestWindow();
41 ~FullscreenControllerTestWindow() override {} 41 ~FullscreenControllerTestWindow() override {}
42 42
43 // BrowserWindow Interface: 43 // BrowserWindow Interface:
44 void EnterFullscreen(const GURL& url,
45 ExclusiveAccessBubbleType type,
46 bool with_toolbar) override;
47 void ExitFullscreen() override;
48 bool ShouldHideUIForFullscreen() const override; 44 bool ShouldHideUIForFullscreen() const override;
49 bool IsFullscreen() const override; 45 bool IsFullscreen() const override;
50 bool SupportsFullscreenWithToolbar() const override; 46 bool SupportsFullscreenWithToolbar() const override;
51 void UpdateFullscreenWithToolbar(bool with_toolbar) override; 47 void UpdateFullscreenWithToolbar(bool with_toolbar) override;
52 bool IsFullscreenWithToolbar() const override; 48 bool IsFullscreenWithToolbar() const override;
53 #if defined(OS_WIN) 49 #if defined(OS_WIN)
54 void SetMetroSnapMode(bool enable) override; 50 void SetMetroSnapMode(bool enable) override;
55 bool IsInMetroSnapMode() const override; 51 bool IsInMetroSnapMode() const override;
56 #endif 52 #endif
57 static const char* GetWindowStateString(WindowState state); 53 static const char* GetWindowStateString(WindowState state);
58 WindowState state() const { return state_; } 54 WindowState state() const { return state_; }
59 void set_browser(Browser* browser) { browser_ = browser; } 55 void set_browser(Browser* browser) { browser_ = browser; }
60 ExclusiveAccessContext* GetExclusiveAccessContext() override; 56 ExclusiveAccessContext* GetExclusiveAccessContext() override;
61 57
62 // ExclusiveAccessContext Interface: 58 // ExclusiveAccessContext Interface:
63 Profile* GetProfile() override; 59 Profile* GetProfile() override;
64 content::WebContents* GetActiveWebContents() override; 60 content::WebContents* GetActiveWebContents() override;
65 void HideDownloadShelf() override; 61 void HideDownloadShelf() override;
66 void UnhideDownloadShelf() override; 62 void UnhideDownloadShelf() override;
63 void EnterFullscreen(const GURL& url,
64 ExclusiveAccessBubbleType type,
65 bool with_toolbar) override;
66 void ExitFullscreen() override;
Peter Kasting 2015/12/03 04:39:11 Also move the definitions of these functions to ma
67 void UpdateExclusiveAccessExitBubbleContent( 67 void UpdateExclusiveAccessExitBubbleContent(
68 const GURL& url, 68 const GURL& url,
69 ExclusiveAccessBubbleType bubble_type) override; 69 ExclusiveAccessBubbleType bubble_type) override;
70 70
71 // Simulates the window changing state. 71 // Simulates the window changing state.
72 void ChangeWindowFullscreenState(); 72 void ChangeWindowFullscreenState();
73 73
74 private: 74 private:
75 // Enters fullscreen with |new_mac_with_toolbar_mode|. 75 // Enters fullscreen with |new_mac_with_toolbar_mode|.
76 void EnterFullscreen(bool new_mac_with_toolbar_mode); 76 void EnterFullscreen(bool new_mac_with_toolbar_mode);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void FullscreenControllerTestWindow::UnhideDownloadShelf() { 233 void FullscreenControllerTestWindow::UnhideDownloadShelf() {
234 GetDownloadShelf()->Unhide(); 234 GetDownloadShelf()->Unhide();
235 } 235 }
236 236
237 void FullscreenControllerTestWindow::HideDownloadShelf() { 237 void FullscreenControllerTestWindow::HideDownloadShelf() {
238 GetDownloadShelf()->Hide(); 238 GetDownloadShelf()->Hide();
239 } 239 }
240 240
241 void FullscreenControllerTestWindow::UpdateExclusiveAccessExitBubbleContent( 241 void FullscreenControllerTestWindow::UpdateExclusiveAccessExitBubbleContent(
242 const GURL& url, 242 const GURL& url,
243 ExclusiveAccessBubbleType bubble_type) { 243 ExclusiveAccessBubbleType bubble_type) {}
244 TestBrowserWindow::UpdateExclusiveAccessExitBubbleContent(url, bubble_type);
245 }
246 244
247 // FullscreenControllerStateUnitTest ------------------------------------------- 245 // FullscreenControllerStateUnitTest -------------------------------------------
248 246
249 // Unit test fixture testing Fullscreen Controller through its states. Most of 247 // Unit test fixture testing Fullscreen Controller through its states. Most of
250 // the test logic comes from FullscreenControllerStateTest. 248 // the test logic comes from FullscreenControllerStateTest.
251 class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest, 249 class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest,
252 public FullscreenControllerStateTest { 250 public FullscreenControllerStateTest {
253 public: 251 public:
254 FullscreenControllerStateUnitTest(); 252 FullscreenControllerStateUnitTest();
255 253
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 444 }
447 } 445 }
448 } 446 }
449 447
450 output << "\n\nAll transitions:"; 448 output << "\n\nAll transitions:";
451 output << GetStateTransitionsAsString(); 449 output << GetStateTransitionsAsString();
452 LOG(INFO) << output.str(); 450 LOG(INFO) << output.str();
453 } 451 }
454 452
455 // Test that the fullscreen exit bubble is closed by 453 // Test that the fullscreen exit bubble is closed by
456 // WindowFullscreenStateChanged() if fullscreen is exited via BrowserWindow. 454 // WindowFullscreenStateChanged() if fullscreen is exited via the
457 // This currently occurs when an extension exits fullscreen via changing the 455 // ExclusiveAccessContext interface.
458 // browser bounds. 456 TEST_F(FullscreenControllerStateUnitTest,
459 TEST_F(FullscreenControllerStateUnitTest, ExitFullscreenViaBrowserWindow) { 457 ExitFullscreenViaExclusiveAccessContext) {
460 AddTab(browser(), GURL(url::kAboutBlankURL)); 458 AddTab(browser(), GURL(url::kAboutBlankURL));
461 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)); 459 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN));
462 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); 460 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
463 ASSERT_TRUE(browser()->window()->IsFullscreen()); 461 ASSERT_TRUE(browser()->window()->IsFullscreen());
464 // Exit fullscreen without going through fullscreen controller. 462 // Exit fullscreen without going through fullscreen controller.
465 browser()->window()->ExitFullscreen(); 463 window_->ExitFullscreen();
466 ChangeWindowFullscreenState(); 464 ChangeWindowFullscreenState();
467 EXPECT_EQ(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, 465 EXPECT_EQ(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE,
468 browser() 466 browser()
469 ->exclusive_access_manager() 467 ->exclusive_access_manager()
470 ->GetExclusiveAccessExitBubbleType()); 468 ->GetExclusiveAccessExitBubbleType());
471 } 469 }
472 470
473 // Test that switching tabs takes the browser out of tab fullscreen. 471 // Test that switching tabs takes the browser out of tab fullscreen.
474 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaSwitchingTab) { 472 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaSwitchingTab) {
475 AddTab(browser(), GURL(url::kAboutBlankURL)); 473 AddTab(browser(), GURL(url::kAboutBlankURL));
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); 825 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab));
828 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); 826 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab));
829 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); 827 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending());
830 EXPECT_FALSE(second_browser->exclusive_access_manager() 828 EXPECT_FALSE(second_browser->exclusive_access_manager()
831 ->fullscreen_controller() 829 ->fullscreen_controller()
832 ->IsWindowFullscreenForTabOrPending()); 830 ->IsWindowFullscreenForTabOrPending());
833 831
834 // Required tear-down specific to this test. 832 // Required tear-down specific to this test.
835 second_browser->tab_strip_model()->CloseAllTabs(); 833 second_browser->tab_strip_model()->CloseAllTabs();
836 } 834 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/view_id_util_browsertest.mm ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698