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/exclusive_access/fullscreen_controller.h" | 9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.h" | 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // browser bounds. | 421 // browser bounds. |
422 TEST_F(FullscreenControllerStateUnitTest, ExitFullscreenViaBrowserWindow) { | 422 TEST_F(FullscreenControllerStateUnitTest, ExitFullscreenViaBrowserWindow) { |
423 AddTab(browser(), GURL(url::kAboutBlankURL)); | 423 AddTab(browser(), GURL(url::kAboutBlankURL)); |
424 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)); | 424 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)); |
425 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); | 425 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); |
426 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 426 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
427 // Exit fullscreen without going through fullscreen controller. | 427 // Exit fullscreen without going through fullscreen controller. |
428 browser()->window()->ExitFullscreen(); | 428 browser()->window()->ExitFullscreen(); |
429 ChangeWindowFullscreenState(); | 429 ChangeWindowFullscreenState(); |
430 EXPECT_EQ(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, | 430 EXPECT_EQ(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, |
431 browser()->fullscreen_controller()->GetExclusiveAccessBubbleType()); | 431 browser() |
| 432 ->exclusive_access_manager() |
| 433 ->GetExclusiveAccessExitBubbleType()); |
432 } | 434 } |
433 | 435 |
434 // Test that switching tabs takes the browser out of tab fullscreen. | 436 // Test that switching tabs takes the browser out of tab fullscreen. |
435 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaSwitchingTab) { | 437 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaSwitchingTab) { |
436 AddTab(browser(), GURL(url::kAboutBlankURL)); | 438 AddTab(browser(), GURL(url::kAboutBlankURL)); |
437 AddTab(browser(), GURL(url::kAboutBlankURL)); | 439 AddTab(browser(), GURL(url::kAboutBlankURL)); |
438 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); | 440 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); |
439 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); | 441 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); |
440 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 442 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
441 | 443 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // have expanded. It is correct for both FullscreenControllers to agree the | 758 // have expanded. It is correct for both FullscreenControllers to agree the |
757 // tab is in fullscreen mode. | 759 // tab is in fullscreen mode. |
758 browser()->tab_strip_model()->DetachWebContentsAt(0); | 760 browser()->tab_strip_model()->DetachWebContentsAt(0); |
759 second_browser->tab_strip_model()-> | 761 second_browser->tab_strip_model()-> |
760 InsertWebContentsAt(0, tab, TabStripModel::ADD_ACTIVE); | 762 InsertWebContentsAt(0, tab, TabStripModel::ADD_ACTIVE); |
761 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 763 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
762 EXPECT_FALSE(second_browser->window()->IsFullscreen()); | 764 EXPECT_FALSE(second_browser->window()->IsFullscreen()); |
763 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab)); | 765 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab)); |
764 EXPECT_TRUE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); | 766 EXPECT_TRUE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); |
765 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); | 767 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); |
766 EXPECT_FALSE(second_browser->fullscreen_controller()-> | 768 EXPECT_FALSE(second_browser->exclusive_access_manager() |
767 IsWindowFullscreenForTabOrPending()); | 769 ->fullscreen_controller() |
| 770 ->IsWindowFullscreenForTabOrPending()); |
768 | 771 |
769 // Now, detach and reattach it back to the first browser window. Again, the | 772 // Now, detach and reattach it back to the first browser window. Again, the |
770 // tab should remain in fullscreen mode and neither browser window should have | 773 // tab should remain in fullscreen mode and neither browser window should have |
771 // expanded. | 774 // expanded. |
772 second_browser->tab_strip_model()->DetachWebContentsAt(0); | 775 second_browser->tab_strip_model()->DetachWebContentsAt(0); |
773 browser()->tab_strip_model()-> | 776 browser()->tab_strip_model()-> |
774 InsertWebContentsAt(0, tab, TabStripModel::ADD_ACTIVE); | 777 InsertWebContentsAt(0, tab, TabStripModel::ADD_ACTIVE); |
775 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 778 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
776 EXPECT_FALSE(second_browser->window()->IsFullscreen()); | 779 EXPECT_FALSE(second_browser->window()->IsFullscreen()); |
777 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab)); | 780 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab)); |
778 EXPECT_TRUE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); | 781 EXPECT_TRUE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); |
779 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); | 782 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); |
780 EXPECT_FALSE(second_browser->fullscreen_controller()-> | 783 EXPECT_FALSE(second_browser->exclusive_access_manager() |
781 IsWindowFullscreenForTabOrPending()); | 784 ->fullscreen_controller() |
| 785 ->IsWindowFullscreenForTabOrPending()); |
782 | 786 |
783 // Exit fullscreen. | 787 // Exit fullscreen. |
784 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)); | 788 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)); |
785 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 789 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
786 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); | 790 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); |
787 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); | 791 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); |
788 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); | 792 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); |
789 EXPECT_FALSE(second_browser->fullscreen_controller()-> | 793 EXPECT_FALSE(second_browser->exclusive_access_manager() |
790 IsWindowFullscreenForTabOrPending()); | 794 ->fullscreen_controller() |
| 795 ->IsWindowFullscreenForTabOrPending()); |
791 | 796 |
792 // Required tear-down specific to this test. | 797 // Required tear-down specific to this test. |
793 second_browser->tab_strip_model()->CloseAllTabs(); | 798 second_browser->tab_strip_model()->CloseAllTabs(); |
794 } | 799 } |
OLD | NEW |