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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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') | chrome/browser/ui/browser_list.cc » ('j') | 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 22 matching lines...) Expand all
33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
34 #include "chrome/common/chrome_notification_types.h" 34 #include "chrome/common/chrome_notification_types.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/extensions/extension.h" 36 #include "chrome/common/extensions/extension.h"
37 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
38 #include "chrome/test/base/in_process_browser_test.h" 38 #include "chrome/test/base/in_process_browser_test.h"
39 #include "chrome/test/base/ui_test_utils.h" 39 #include "chrome/test/base/ui_test_utils.h"
40 #include "content/browser/renderer_host/render_process_host.h" 40 #include "content/browser/renderer_host/render_process_host.h"
41 #include "content/browser/renderer_host/render_view_host.h" 41 #include "content/browser/renderer_host/render_view_host.h"
42 #include "content/browser/tab_contents/tab_contents.h" 42 #include "content/browser/tab_contents/tab_contents.h"
43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_source.h" 44 #include "content/public/browser/notification_source.h"
44 #include "content/public/common/page_transition_types.h" 45 #include "content/public/common/page_transition_types.h"
45 #include "content/public/common/url_constants.h" 46 #include "content/public/common/url_constants.h"
46 #include "grit/chromium_strings.h" 47 #include "grit/chromium_strings.h"
47 #include "grit/generated_resources.h" 48 #include "grit/generated_resources.h"
48 #include "net/base/mock_host_resolver.h" 49 #include "net/base/mock_host_resolver.h"
49 #include "net/test/test_server.h" 50 #include "net/test/test_server.h"
50 #include "ui/base/l10n/l10n_util.h" 51 #include "ui/base/l10n/l10n_util.h"
51 52
52 #if defined(OS_WIN) 53 #if defined(OS_WIN)
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 FilePath(kBeforeUnloadFile))); 293 FilePath(kBeforeUnloadFile)));
293 ui_test_utils::NavigateToURL(browser(), url); 294 ui_test_utils::NavigateToURL(browser(), url);
294 295
295 // Navigate to a page that triggers a cross-site transition. 296 // Navigate to a page that triggers a cross-site transition.
296 ASSERT_TRUE(test_server()->Start()); 297 ASSERT_TRUE(test_server()->Start());
297 GURL url2(test_server()->GetURL("files/title1.html")); 298 GURL url2(test_server()->GetURL("files/title1.html"));
298 browser()->OpenURL(url2, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); 299 browser()->OpenURL(url2, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED);
299 300
300 ui_test_utils::WindowedNotificationObserver host_destroyed_observer( 301 ui_test_utils::WindowedNotificationObserver host_destroyed_observer(
301 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 302 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
302 NotificationService::AllSources()); 303 content::NotificationService::AllSources());
303 304
304 // Cancel the dialog. 305 // Cancel the dialog.
305 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 306 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
306 alert->CloseModalDialog(); 307 alert->CloseModalDialog();
307 EXPECT_FALSE(browser()->GetSelectedTabContents()->IsLoading()); 308 EXPECT_FALSE(browser()->GetSelectedTabContents()->IsLoading());
308 309
309 // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for 310 // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for
310 // the pending RVH to be destroyed. 311 // the pending RVH to be destroyed.
311 host_destroyed_observer.Wait(); 312 host_destroyed_observer.Wait();
312 EXPECT_EQ(url.spec(), UTF16ToUTF8(browser()->toolbar_model()->GetText())); 313 EXPECT_EQ(url.spec(), UTF16ToUTF8(browser()->toolbar_model()->GetText()));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Now open a tab to a blank page, set its opener to null, and redirect it 374 // Now open a tab to a blank page, set its opener to null, and redirect it
374 // cross-site. 375 // cross-site.
375 std::string redirect_popup = "w=window.open();"; 376 std::string redirect_popup = "w=window.open();";
376 redirect_popup += "w.opener=null;"; 377 redirect_popup += "w.opener=null;";
377 redirect_popup += "w.document.location=\""; 378 redirect_popup += "w.document.location=\"";
378 redirect_popup += https_url.spec(); 379 redirect_popup += https_url.spec();
379 redirect_popup += "\";"; 380 redirect_popup += "\";";
380 381
381 ui_test_utils::WindowedNotificationObserver popup_observer( 382 ui_test_utils::WindowedNotificationObserver popup_observer(
382 content::NOTIFICATION_TAB_ADDED, 383 content::NOTIFICATION_TAB_ADDED,
383 NotificationService::AllSources()); 384 content::NotificationService::AllSources());
384 ui_test_utils::WindowedNotificationObserver nav_observer( 385 ui_test_utils::WindowedNotificationObserver nav_observer(
385 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 386 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
386 NotificationService::AllSources()); 387 content::NotificationService::AllSources());
387 oldtab->render_view_host()-> 388 oldtab->render_view_host()->
388 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(redirect_popup)); 389 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(redirect_popup));
389 390
390 // Wait for popup window to appear and finish navigating. 391 // Wait for popup window to appear and finish navigating.
391 popup_observer.Wait(); 392 popup_observer.Wait();
392 ASSERT_EQ(2, browser()->tab_count()); 393 ASSERT_EQ(2, browser()->tab_count());
393 TabContents* newtab = browser()->GetSelectedTabContents(); 394 TabContents* newtab = browser()->GetSelectedTabContents();
394 EXPECT_TRUE(newtab); 395 EXPECT_TRUE(newtab);
395 EXPECT_NE(oldtab, newtab); 396 EXPECT_NE(oldtab, newtab);
396 nav_observer.Wait(); 397 nav_observer.Wait();
397 ASSERT_TRUE(newtab->controller().GetLastCommittedEntry()); 398 ASSERT_TRUE(newtab->controller().GetLastCommittedEntry());
398 EXPECT_EQ(https_url.spec(), 399 EXPECT_EQ(https_url.spec(),
399 newtab->controller().GetLastCommittedEntry()->url().spec()); 400 newtab->controller().GetLastCommittedEntry()->url().spec());
400 401
401 // Popup window should not be in the opener's process. 402 // Popup window should not be in the opener's process.
402 RenderProcessHost* popup_process = newtab->render_view_host()->process(); 403 RenderProcessHost* popup_process = newtab->render_view_host()->process();
403 EXPECT_NE(process, popup_process); 404 EXPECT_NE(process, popup_process);
404 405
405 // Now open a tab to a blank page, set its opener to null, and use a 406 // Now open a tab to a blank page, set its opener to null, and use a
406 // meta-refresh to navigate it instead. 407 // meta-refresh to navigate it instead.
407 std::string refresh_popup = "w=window.open();"; 408 std::string refresh_popup = "w=window.open();";
408 refresh_popup += "w.opener=null;"; 409 refresh_popup += "w.opener=null;";
409 refresh_popup += "w.document.write("; 410 refresh_popup += "w.document.write(";
410 refresh_popup += "'<META HTTP-EQUIV=\"refresh\" content=\"0; url="; 411 refresh_popup += "'<META HTTP-EQUIV=\"refresh\" content=\"0; url=";
411 refresh_popup += https_url.spec(); 412 refresh_popup += https_url.spec();
412 refresh_popup += "\">');w.document.close();"; 413 refresh_popup += "\">');w.document.close();";
413 414
414 ui_test_utils::WindowedNotificationObserver popup_observer2( 415 ui_test_utils::WindowedNotificationObserver popup_observer2(
415 content::NOTIFICATION_TAB_ADDED, 416 content::NOTIFICATION_TAB_ADDED,
416 NotificationService::AllSources()); 417 content::NotificationService::AllSources());
417 ui_test_utils::WindowedNotificationObserver nav_observer2( 418 ui_test_utils::WindowedNotificationObserver nav_observer2(
418 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 419 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
419 NotificationService::AllSources()); 420 content::NotificationService::AllSources());
420 oldtab->render_view_host()-> 421 oldtab->render_view_host()->
421 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(refresh_popup)); 422 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(refresh_popup));
422 423
423 // Wait for popup window to appear and finish navigating. 424 // Wait for popup window to appear and finish navigating.
424 popup_observer2.Wait(); 425 popup_observer2.Wait();
425 ASSERT_EQ(3, browser()->tab_count()); 426 ASSERT_EQ(3, browser()->tab_count());
426 TabContents* newtab2 = browser()->GetSelectedTabContents(); 427 TabContents* newtab2 = browser()->GetSelectedTabContents();
427 EXPECT_TRUE(newtab2); 428 EXPECT_TRUE(newtab2);
428 EXPECT_NE(oldtab, newtab2); 429 EXPECT_NE(oldtab, newtab2);
429 nav_observer2.Wait(); 430 nav_observer2.Wait();
(...skipping 28 matching lines...) Expand all
458 459
459 // Now open a tab to a blank page, set its opener to null, and redirect it 460 // Now open a tab to a blank page, set its opener to null, and redirect it
460 // cross-site. 461 // cross-site.
461 std::string dont_fork_popup = "w=window.open();"; 462 std::string dont_fork_popup = "w=window.open();";
462 dont_fork_popup += "w.document.location=\""; 463 dont_fork_popup += "w.document.location=\"";
463 dont_fork_popup += https_url.spec(); 464 dont_fork_popup += https_url.spec();
464 dont_fork_popup += "\";"; 465 dont_fork_popup += "\";";
465 466
466 ui_test_utils::WindowedNotificationObserver popup_observer( 467 ui_test_utils::WindowedNotificationObserver popup_observer(
467 content::NOTIFICATION_TAB_ADDED, 468 content::NOTIFICATION_TAB_ADDED,
468 NotificationService::AllSources()); 469 content::NotificationService::AllSources());
469 ui_test_utils::WindowedNotificationObserver nav_observer( 470 ui_test_utils::WindowedNotificationObserver nav_observer(
470 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 471 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
471 NotificationService::AllSources()); 472 content::NotificationService::AllSources());
472 oldtab->render_view_host()-> 473 oldtab->render_view_host()->
473 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(dont_fork_popup)); 474 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(dont_fork_popup));
474 475
475 // Wait for popup window to appear and finish navigating. 476 // Wait for popup window to appear and finish navigating.
476 popup_observer.Wait(); 477 popup_observer.Wait();
477 ASSERT_EQ(2, browser()->tab_count()); 478 ASSERT_EQ(2, browser()->tab_count());
478 TabContents* newtab = browser()->GetSelectedTabContents(); 479 TabContents* newtab = browser()->GetSelectedTabContents();
479 EXPECT_TRUE(newtab); 480 EXPECT_TRUE(newtab);
480 EXPECT_NE(oldtab, newtab); 481 EXPECT_NE(oldtab, newtab);
481 nav_observer.Wait(); 482 nav_observer.Wait();
482 ASSERT_TRUE(newtab->controller().GetLastCommittedEntry()); 483 ASSERT_TRUE(newtab->controller().GetLastCommittedEntry());
483 EXPECT_EQ(https_url.spec(), 484 EXPECT_EQ(https_url.spec(),
484 newtab->controller().GetLastCommittedEntry()->url().spec()); 485 newtab->controller().GetLastCommittedEntry()->url().spec());
485 486
486 // Popup window should still be in the opener's process. 487 // Popup window should still be in the opener's process.
487 RenderProcessHost* popup_process = newtab->render_view_host()->process(); 488 RenderProcessHost* popup_process = newtab->render_view_host()->process();
488 EXPECT_EQ(process, popup_process); 489 EXPECT_EQ(process, popup_process);
489 490
490 // Same thing if the current tab tries to navigate itself. 491 // Same thing if the current tab tries to navigate itself.
491 std::string navigate_str = "document.location=\""; 492 std::string navigate_str = "document.location=\"";
492 navigate_str += https_url.spec(); 493 navigate_str += https_url.spec();
493 navigate_str += "\";"; 494 navigate_str += "\";";
494 495
495 ui_test_utils::WindowedNotificationObserver nav_observer2( 496 ui_test_utils::WindowedNotificationObserver nav_observer2(
496 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 497 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
497 NotificationService::AllSources()); 498 content::NotificationService::AllSources());
498 oldtab->render_view_host()-> 499 oldtab->render_view_host()->
499 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(navigate_str)); 500 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(navigate_str));
500 nav_observer2.Wait(); 501 nav_observer2.Wait();
501 ASSERT_TRUE(oldtab->controller().GetLastCommittedEntry()); 502 ASSERT_TRUE(oldtab->controller().GetLastCommittedEntry());
502 EXPECT_EQ(https_url.spec(), 503 EXPECT_EQ(https_url.spec(),
503 oldtab->controller().GetLastCommittedEntry()->url().spec()); 504 oldtab->controller().GetLastCommittedEntry()->url().spec());
504 505
505 // Original window should still be in the original process. 506 // Original window should still be in the original process.
506 RenderProcessHost* new_process = newtab->render_view_host()->process(); 507 RenderProcessHost* new_process = newtab->render_view_host()->process();
507 EXPECT_EQ(process, new_process); 508 EXPECT_EQ(process, new_process);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 ASSERT_TRUE(test_server()->Start()); 818 ASSERT_TRUE(test_server()->Start());
818 819
819 AddTabAtIndex( 820 AddTabAtIndex(
820 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); 821 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED);
821 822
822 TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); 823 TabContents* fullscreen_tab = browser()->GetSelectedTabContents();
823 824
824 { 825 {
825 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 826 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
826 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 827 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
827 NotificationService::AllSources()); 828 content::NotificationService::AllSources());
828 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); 829 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true);
829 fullscreen_observer.Wait(); 830 fullscreen_observer.Wait();
830 ASSERT_TRUE(browser()->window()->IsFullscreen()); 831 ASSERT_TRUE(browser()->window()->IsFullscreen());
831 } 832 }
832 833
833 { 834 {
834 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 835 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
835 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 836 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
836 NotificationService::AllSources()); 837 content::NotificationService::AllSources());
837 AddTabAtIndex( 838 AddTabAtIndex(
838 1, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); 839 1, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED);
839 fullscreen_observer.Wait(); 840 fullscreen_observer.Wait();
840 ASSERT_FALSE(browser()->window()->IsFullscreen()); 841 ASSERT_FALSE(browser()->window()->IsFullscreen());
841 } 842 }
842 } 843 }
843 844
844 #if defined(OS_MACOSX) 845 #if defined(OS_MACOSX)
845 // http://crbug.com/100467 846 // http://crbug.com/100467
846 #define MAYBE_TestTabExitsItselfFromFullscreen \ 847 #define MAYBE_TestTabExitsItselfFromFullscreen \
847 FAILS_TestTabExitsItselfFromFullscreen 848 FAILS_TestTabExitsItselfFromFullscreen
848 #else 849 #else
849 #define MAYBE_TestTabExitsItselfFromFullscreen TestTabExitsItselfFromFullscreen 850 #define MAYBE_TestTabExitsItselfFromFullscreen TestTabExitsItselfFromFullscreen
850 #endif 851 #endif
851 852
852 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TestTabExitsItselfFromFullscreen) { 853 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TestTabExitsItselfFromFullscreen) {
853 ASSERT_TRUE(test_server()->Start()); 854 ASSERT_TRUE(test_server()->Start());
854 855
855 AddTabAtIndex( 856 AddTabAtIndex(
856 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); 857 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED);
857 858
858 TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); 859 TabContents* fullscreen_tab = browser()->GetSelectedTabContents();
859 860
860 { 861 {
861 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 862 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
862 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 863 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
863 NotificationService::AllSources()); 864 content::NotificationService::AllSources());
864 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); 865 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true);
865 fullscreen_observer.Wait(); 866 fullscreen_observer.Wait();
866 ASSERT_TRUE(browser()->window()->IsFullscreen()); 867 ASSERT_TRUE(browser()->window()->IsFullscreen());
867 } 868 }
868 869
869 { 870 {
870 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 871 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
871 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 872 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
872 NotificationService::AllSources()); 873 content::NotificationService::AllSources());
873 browser()->ToggleFullscreenModeForTab(fullscreen_tab, false); 874 browser()->ToggleFullscreenModeForTab(fullscreen_tab, false);
874 fullscreen_observer.Wait(); 875 fullscreen_observer.Wait();
875 ASSERT_FALSE(browser()->window()->IsFullscreen()); 876 ASSERT_FALSE(browser()->window()->IsFullscreen());
876 } 877 }
877 } 878 }
878 879
879 #if defined(OS_LINUX) 880 #if defined(OS_LINUX)
880 // http://crbug.com/100680. 881 // http://crbug.com/100680.
881 #define MAYBE_TestFullscreenBubbleMouseLockState \ 882 #define MAYBE_TestFullscreenBubbleMouseLockState \
882 DISABLED_TestFullscreenBubbleMouseLockState 883 DISABLED_TestFullscreenBubbleMouseLockState
883 #else 884 #else
884 #define MAYBE_TestFullscreenBubbleMouseLockState \ 885 #define MAYBE_TestFullscreenBubbleMouseLockState \
885 TestFullscreenBubbleMouseLockState 886 TestFullscreenBubbleMouseLockState
886 #endif 887 #endif
887 888
888 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TestFullscreenBubbleMouseLockState) { 889 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TestFullscreenBubbleMouseLockState) {
889 ASSERT_TRUE(test_server()->Start()); 890 ASSERT_TRUE(test_server()->Start());
890 891
891 AddTabAtIndex(0, GURL(chrome::kAboutBlankURL), 892 AddTabAtIndex(0, GURL(chrome::kAboutBlankURL),
892 content::PAGE_TRANSITION_TYPED); 893 content::PAGE_TRANSITION_TYPED);
893 894
894 TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); 895 TabContents* fullscreen_tab = browser()->GetSelectedTabContents();
895 896
896 { 897 {
897 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 898 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
898 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 899 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
899 NotificationService::AllSources()); 900 content::NotificationService::AllSources());
900 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); 901 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true);
901 fullscreen_observer.Wait(); 902 fullscreen_observer.Wait();
902 ASSERT_TRUE(browser()->window()->IsFullscreen()); 903 ASSERT_TRUE(browser()->window()->IsFullscreen());
903 } 904 }
904 905
905 browser()->RequestToLockMouse(fullscreen_tab); 906 browser()->RequestToLockMouse(fullscreen_tab);
906 FullscreenExitBubbleType type = browser()->GetFullscreenExitBubbleType(); 907 FullscreenExitBubbleType type = browser()->GetFullscreenExitBubbleType();
907 bool mouse_lock = false; 908 bool mouse_lock = false;
908 fullscreen_bubble::PermissionRequestedByType(type, NULL, &mouse_lock); 909 fullscreen_bubble::PermissionRequestedByType(type, NULL, &mouse_lock);
909 ASSERT_TRUE(mouse_lock); 910 ASSERT_TRUE(mouse_lock);
(...skipping 10 matching lines...) Expand all
920 ASSERT_TRUE(test_server()->Start()); 921 ASSERT_TRUE(test_server()->Start());
921 922
922 AddTabAtIndex( 923 AddTabAtIndex(
923 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); 924 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED);
924 925
925 TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); 926 TabContents* fullscreen_tab = browser()->GetSelectedTabContents();
926 927
927 { 928 {
928 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 929 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
929 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 930 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
930 NotificationService::AllSources()); 931 content::NotificationService::AllSources());
931 EXPECT_FALSE(browser()->window()->IsFullscreen()); 932 EXPECT_FALSE(browser()->window()->IsFullscreen());
932 EXPECT_FALSE(browser()->window()->InPresentationMode()); 933 EXPECT_FALSE(browser()->window()->InPresentationMode());
933 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); 934 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true);
934 fullscreen_observer.Wait(); 935 fullscreen_observer.Wait();
935 ASSERT_TRUE(browser()->window()->IsFullscreen()); 936 ASSERT_TRUE(browser()->window()->IsFullscreen());
936 ASSERT_TRUE(browser()->window()->InPresentationMode()); 937 ASSERT_TRUE(browser()->window()->InPresentationMode());
937 } 938 }
938 939
939 { 940 {
940 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 941 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
941 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 942 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
942 NotificationService::AllSources()); 943 content::NotificationService::AllSources());
943 browser()->TogglePresentationMode(false); 944 browser()->TogglePresentationMode(false);
944 fullscreen_observer.Wait(); 945 fullscreen_observer.Wait();
945 ASSERT_FALSE(browser()->window()->IsFullscreen()); 946 ASSERT_FALSE(browser()->window()->IsFullscreen());
946 ASSERT_FALSE(browser()->window()->InPresentationMode()); 947 ASSERT_FALSE(browser()->window()->InPresentationMode());
947 } 948 }
948 949
949 if (base::mac::IsOSLionOrLater()) { 950 if (base::mac::IsOSLionOrLater()) {
950 // Test that tab fullscreen mode doesn't make presentation mode the default 951 // Test that tab fullscreen mode doesn't make presentation mode the default
951 // on Lion. 952 // on Lion.
952 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 953 ui_test_utils::WindowedNotificationObserver fullscreen_observer(
953 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 954 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
954 NotificationService::AllSources()); 955 content::NotificationService::AllSources());
955 browser()->ToggleFullscreenMode(false); 956 browser()->ToggleFullscreenMode(false);
956 fullscreen_observer.Wait(); 957 fullscreen_observer.Wait();
957 ASSERT_TRUE(browser()->window()->IsFullscreen()); 958 ASSERT_TRUE(browser()->window()->IsFullscreen());
958 ASSERT_FALSE(browser()->window()->InPresentationMode()); 959 ASSERT_FALSE(browser()->window()->InPresentationMode());
959 } 960 }
960 } 961 }
961 #endif 962 #endif
962 963
963 // Chromeos defaults to restoring the last session, so this test isn't 964 // Chromeos defaults to restoring the last session, so this test isn't
964 // applicable. 965 // applicable.
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 1234
1234 // The normal browser should now have four. 1235 // The normal browser should now have four.
1235 EXPECT_EQ(4, browser()->tab_count()); 1236 EXPECT_EQ(4, browser()->tab_count());
1236 1237
1237 // Close the additional browsers. 1238 // Close the additional browsers.
1238 popup_browser->CloseAllTabs(); 1239 popup_browser->CloseAllTabs();
1239 app_browser->CloseAllTabs(); 1240 app_browser->CloseAllTabs();
1240 app_popup_browser->CloseAllTabs(); 1241 app_popup_browser->CloseAllTabs();
1241 } 1242 }
1242 #endif 1243 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698