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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 7966031: Exit tabbed fullscreen mode on navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #if defined(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 "</body></html>"; 60 "</body></html>";
61 61
62 const char* kOpenNewBeforeUnloadPage = 62 const char* kOpenNewBeforeUnloadPage =
63 "w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; 63 "w=window.open(); w.onbeforeunload=function(e){return 'foo'};";
64 64
65 const FilePath::CharType* kBeforeUnloadFile = 65 const FilePath::CharType* kBeforeUnloadFile =
66 FILE_PATH_LITERAL("beforeunload.html"); 66 FILE_PATH_LITERAL("beforeunload.html");
67 67
68 const FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html"); 68 const FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html");
69 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); 69 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html");
70 const FilePath::CharType* kSubFrameNavigationFile =
71 FILE_PATH_LITERAL("subframe-navigation.html");
70 72
71 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); 73 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
72 74
73 // Given a page title, returns the expected window caption string. 75 // Given a page title, returns the expected window caption string.
74 std::wstring WindowCaptionFromPageTitle(std::wstring page_title) { 76 std::wstring WindowCaptionFromPageTitle(std::wstring page_title) {
75 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) 77 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
76 // On Mac or ChromeOS, we don't want to suffix the page title with 78 // On Mac or ChromeOS, we don't want to suffix the page title with
77 // the application name. 79 // the application name.
78 if (page_title.empty()) { 80 if (page_title.empty()) {
79 return UTF16ToWideHack( 81 return UTF16ToWideHack(
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 { 848 {
847 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 849 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
848 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 850 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
849 NotificationService::AllSources()); 851 NotificationService::AllSources());
850 browser()->ToggleFullscreenModeForTab(fullscreen_tab, false); 852 browser()->ToggleFullscreenModeForTab(fullscreen_tab, false);
851 fullscreen_observer.Wait(); 853 fullscreen_observer.Wait();
852 ASSERT_FALSE(browser()->window()->IsFullscreen()); 854 ASSERT_FALSE(browser()->window()->IsFullscreen());
853 } 855 }
854 } 856 }
855 857
858 IN_PROC_BROWSER_TEST_F(BrowserTest, TestTabExitsFullscreenOnNavigation) {
859 ASSERT_TRUE(test_server()->Start());
860
861 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
862 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"));
863
864 TabContents* fullscreen_tab = browser()->GetSelectedTabContents();
865
866 ui_test_utils::WindowedNotificationObserver tree_updated_observer1(
867 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
868 NotificationService::AllSources());
869 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true);
870 tree_updated_observer1.Wait();
871
872 ASSERT_TRUE(browser()->window()->IsFullscreen());
873
874 ui_test_utils::WindowedNotificationObserver tree_updated_observer2(
875 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
876 NotificationService::AllSources());
877 browser()->GoBack(CURRENT_TAB);
878 tree_updated_observer2.Wait();
879
880 ASSERT_FALSE(browser()->window()->IsFullscreen());
881 }
882
883 IN_PROC_BROWSER_TEST_F(BrowserTest,
884 TestTabDoesntExitFullscreenOnSubFrameNavigation) {
885 ASSERT_TRUE(test_server()->Start());
886
887 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
888 FilePath(kSubFrameNavigationFile)));
889 ui_test_utils::NavigateToURL(browser(), url);
890
891 TabContents* fullscreen_tab = browser()->GetSelectedTabContents();
892
893 ui_test_utils::WindowedNotificationObserver tree_updated_observer1(
894 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
895 NotificationService::AllSources());
896 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true);
897 tree_updated_observer1.Wait();
898 ASSERT_TRUE(browser()->window()->IsFullscreen());
899
900 fullscreen_tab->render_view_host()->
901 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("navigate();"));
902 ASSERT_TRUE(browser()->window()->IsFullscreen());
903 }
904
856 #if defined(OS_MACOSX) 905 #if defined(OS_MACOSX)
857 IN_PROC_BROWSER_TEST_F(BrowserTest, TabEntersPresentationModeFromWindowed) { 906 IN_PROC_BROWSER_TEST_F(BrowserTest, TabEntersPresentationModeFromWindowed) {
858 ASSERT_TRUE(test_server()->Start()); 907 ASSERT_TRUE(test_server()->Start());
859 908
860 AddTabAtIndex(0, GURL(chrome::kAboutBlankURL), PageTransition::TYPED); 909 AddTabAtIndex(0, GURL(chrome::kAboutBlankURL), PageTransition::TYPED);
861 910
862 TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); 911 TabContents* fullscreen_tab = browser()->GetSelectedTabContents();
863 912
864 { 913 {
865 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 914 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1187
1139 // The normal browser should now have four. 1188 // The normal browser should now have four.
1140 EXPECT_EQ(4, browser()->tab_count()); 1189 EXPECT_EQ(4, browser()->tab_count());
1141 1190
1142 // Close the additional browsers. 1191 // Close the additional browsers.
1143 popup_browser->CloseAllTabs(); 1192 popup_browser->CloseAllTabs();
1144 app_browser->CloseAllTabs(); 1193 app_browser->CloseAllTabs();
1145 app_popup_browser->CloseAllTabs(); 1194 app_popup_browser->CloseAllTabs();
1146 } 1195 }
1147 #endif 1196 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698