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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 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 "base/test/histogram_tester.h" 6 #include "base/test/histogram_tester.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h" 9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // Test that switching tabs via detaching the active tab (which is in tab 478 // Test that switching tabs via detaching the active tab (which is in tab
479 // fullscreen) takes the browser out of tab fullscreen. This case can 479 // fullscreen) takes the browser out of tab fullscreen. This case can
480 // occur if the user is in both tab fullscreen and immersive browser fullscreen. 480 // occur if the user is in both tab fullscreen and immersive browser fullscreen.
481 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaDetachingTab) { 481 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaDetachingTab) {
482 AddTab(browser(), GURL(url::kAboutBlankURL)); 482 AddTab(browser(), GURL(url::kAboutBlankURL));
483 AddTab(browser(), GURL(url::kAboutBlankURL)); 483 AddTab(browser(), GURL(url::kAboutBlankURL));
484 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 484 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
485 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); 485 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
486 ASSERT_TRUE(browser()->window()->IsFullscreen()); 486 ASSERT_TRUE(browser()->window()->IsFullscreen());
487 487
488 scoped_ptr<content::WebContents> web_contents( 488 std::unique_ptr<content::WebContents> web_contents(
489 browser()->tab_strip_model()->DetachWebContentsAt(0)); 489 browser()->tab_strip_model()->DetachWebContentsAt(0));
490 ChangeWindowFullscreenState(); 490 ChangeWindowFullscreenState();
491 EXPECT_FALSE(browser()->window()->IsFullscreen()); 491 EXPECT_FALSE(browser()->window()->IsFullscreen());
492 } 492 }
493 493
494 // Test that replacing the web contents for a tab which is in tab fullscreen 494 // Test that replacing the web contents for a tab which is in tab fullscreen
495 // takes the browser out of tab fullscreen. This can occur if the user 495 // takes the browser out of tab fullscreen. This can occur if the user
496 // navigates to a prerendered page from a page which is tab fullscreen. 496 // navigates to a prerendered page from a page which is tab fullscreen.
497 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaReplacingTab) { 497 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaReplacingTab) {
498 AddTab(browser(), GURL(url::kAboutBlankURL)); 498 AddTab(browser(), GURL(url::kAboutBlankURL));
499 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 499 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
500 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); 500 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
501 ASSERT_TRUE(browser()->window()->IsFullscreen()); 501 ASSERT_TRUE(browser()->window()->IsFullscreen());
502 502
503 content::WebContents* new_web_contents = content::WebContents::Create( 503 content::WebContents* new_web_contents = content::WebContents::Create(
504 content::WebContents::CreateParams(profile())); 504 content::WebContents::CreateParams(profile()));
505 scoped_ptr<content::WebContents> old_web_contents( 505 std::unique_ptr<content::WebContents> old_web_contents(
506 browser()->tab_strip_model()->ReplaceWebContentsAt( 506 browser()->tab_strip_model()->ReplaceWebContentsAt(0, new_web_contents));
507 0, new_web_contents));
508 ChangeWindowFullscreenState(); 507 ChangeWindowFullscreenState();
509 EXPECT_FALSE(browser()->window()->IsFullscreen()); 508 EXPECT_FALSE(browser()->window()->IsFullscreen());
510 } 509 }
511 510
512 // Tests that, in a browser configured for Fullscreen-Within-Tab mode, 511 // Tests that, in a browser configured for Fullscreen-Within-Tab mode,
513 // fullscreening a screen-captured tab will NOT cause any fullscreen state 512 // fullscreening a screen-captured tab will NOT cause any fullscreen state
514 // change to the browser window. Furthermore, the test switches between tabs to 513 // change to the browser window. Furthermore, the test switches between tabs to
515 // confirm a captured tab will be resized by FullscreenController to the capture 514 // confirm a captured tab will be resized by FullscreenController to the capture
516 // video resolution once the widget is detached from the UI. 515 // video resolution once the widget is detached from the UI.
517 // 516 //
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 ASSERT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); 822 ASSERT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending());
824 823
825 // Enter tab fullscreen. Since the tab is being captured, the browser window 824 // Enter tab fullscreen. Since the tab is being captured, the browser window
826 // should not expand to fill the screen. 825 // should not expand to fill the screen.
827 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 826 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
828 EXPECT_FALSE(browser()->window()->IsFullscreen()); 827 EXPECT_FALSE(browser()->window()->IsFullscreen());
829 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab)); 828 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab));
830 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); 829 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending());
831 830
832 // Create the second browser window. 831 // Create the second browser window.
833 const scoped_ptr<BrowserWindow> second_browser_window(CreateBrowserWindow()); 832 const std::unique_ptr<BrowserWindow> second_browser_window(
834 const scoped_ptr<Browser> second_browser( 833 CreateBrowserWindow());
834 const std::unique_ptr<Browser> second_browser(
835 CreateBrowser(browser()->profile(), browser()->type(), false, 835 CreateBrowser(browser()->profile(), browser()->type(), false,
836 second_browser_window.get())); 836 second_browser_window.get()));
837 AddTab(second_browser.get(), GURL(url::kAboutBlankURL)); 837 AddTab(second_browser.get(), GURL(url::kAboutBlankURL));
838 content::WebContentsDelegate* const second_wc_delegate = 838 content::WebContentsDelegate* const second_wc_delegate =
839 static_cast<content::WebContentsDelegate*>(second_browser.get()); 839 static_cast<content::WebContentsDelegate*>(second_browser.get());
840 840
841 // Detach the tab from the first browser window and attach it to the second. 841 // Detach the tab from the first browser window and attach it to the second.
842 // The tab should remain in fullscreen mode and neither browser window should 842 // The tab should remain in fullscreen mode and neither browser window should
843 // have expanded. It is correct for both FullscreenControllers to agree the 843 // have expanded. It is correct for both FullscreenControllers to agree the
844 // tab is in fullscreen mode. 844 // tab is in fullscreen mode.
(...skipping 30 matching lines...) Expand all
875 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); 875 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab));
876 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); 876 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab));
877 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); 877 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending());
878 EXPECT_FALSE(second_browser->exclusive_access_manager() 878 EXPECT_FALSE(second_browser->exclusive_access_manager()
879 ->fullscreen_controller() 879 ->fullscreen_controller()
880 ->IsWindowFullscreenForTabOrPending()); 880 ->IsWindowFullscreenForTabOrPending());
881 881
882 // Required tear-down specific to this test. 882 // Required tear-down specific to this test.
883 second_browser->tab_strip_model()->CloseAllTabs(); 883 second_browser->tab_strip_model()->CloseAllTabs();
884 } 884 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698