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