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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 530 |
531 // Now open a tab to a blank page, set its opener to null, and redirect it | 531 // Now open a tab to a blank page, set its opener to null, and redirect it |
532 // cross-site. | 532 // cross-site. |
533 std::string redirect_popup = "w=window.open();"; | 533 std::string redirect_popup = "w=window.open();"; |
534 redirect_popup += "w.opener=null;"; | 534 redirect_popup += "w.opener=null;"; |
535 redirect_popup += "w.document.location=\""; | 535 redirect_popup += "w.document.location=\""; |
536 redirect_popup += https_url.spec(); | 536 redirect_popup += https_url.spec(); |
537 redirect_popup += "\";"; | 537 redirect_popup += "\";"; |
538 | 538 |
539 ui_test_utils::WindowedNotificationObserver popup_observer( | 539 ui_test_utils::WindowedNotificationObserver popup_observer( |
540 content::NOTIFICATION_TAB_ADDED, | 540 chrome::NOTIFICATION_TAB_ADDED, |
541 content::NotificationService::AllSources()); | 541 content::NotificationService::AllSources()); |
542 ui_test_utils::WindowedNotificationObserver nav_observer( | 542 ui_test_utils::WindowedNotificationObserver nav_observer( |
543 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 543 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
544 content::NotificationService::AllSources()); | 544 content::NotificationService::AllSources()); |
545 oldtab->GetRenderViewHost()-> | 545 oldtab->GetRenderViewHost()-> |
546 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(redirect_popup)); | 546 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(redirect_popup)); |
547 | 547 |
548 // Wait for popup window to appear and finish navigating. | 548 // Wait for popup window to appear and finish navigating. |
549 popup_observer.Wait(); | 549 popup_observer.Wait(); |
550 ASSERT_EQ(2, browser()->tab_count()); | 550 ASSERT_EQ(2, browser()->tab_count()); |
(...skipping 13 matching lines...) Expand all Loading... |
564 // Now open a tab to a blank page, set its opener to null, and use a | 564 // Now open a tab to a blank page, set its opener to null, and use a |
565 // meta-refresh to navigate it instead. | 565 // meta-refresh to navigate it instead. |
566 std::string refresh_popup = "w=window.open();"; | 566 std::string refresh_popup = "w=window.open();"; |
567 refresh_popup += "w.opener=null;"; | 567 refresh_popup += "w.opener=null;"; |
568 refresh_popup += "w.document.write("; | 568 refresh_popup += "w.document.write("; |
569 refresh_popup += "'<META HTTP-EQUIV=\"refresh\" content=\"0; url="; | 569 refresh_popup += "'<META HTTP-EQUIV=\"refresh\" content=\"0; url="; |
570 refresh_popup += https_url.spec(); | 570 refresh_popup += https_url.spec(); |
571 refresh_popup += "\">');w.document.close();"; | 571 refresh_popup += "\">');w.document.close();"; |
572 | 572 |
573 ui_test_utils::WindowedNotificationObserver popup_observer2( | 573 ui_test_utils::WindowedNotificationObserver popup_observer2( |
574 content::NOTIFICATION_TAB_ADDED, | 574 chrome::NOTIFICATION_TAB_ADDED, |
575 content::NotificationService::AllSources()); | 575 content::NotificationService::AllSources()); |
576 ui_test_utils::WindowedNotificationObserver nav_observer2( | 576 ui_test_utils::WindowedNotificationObserver nav_observer2( |
577 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 577 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
578 content::NotificationService::AllSources()); | 578 content::NotificationService::AllSources()); |
579 oldtab->GetRenderViewHost()-> | 579 oldtab->GetRenderViewHost()-> |
580 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(refresh_popup)); | 580 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(refresh_popup)); |
581 | 581 |
582 // Wait for popup window to appear and finish navigating. | 582 // Wait for popup window to appear and finish navigating. |
583 popup_observer2.Wait(); | 583 popup_observer2.Wait(); |
584 ASSERT_EQ(3, browser()->tab_count()); | 584 ASSERT_EQ(3, browser()->tab_count()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); | 618 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); |
619 | 619 |
620 // Now open a tab to a blank page, set its opener to null, and redirect it | 620 // Now open a tab to a blank page, set its opener to null, and redirect it |
621 // cross-site. | 621 // cross-site. |
622 std::string dont_fork_popup = "w=window.open();"; | 622 std::string dont_fork_popup = "w=window.open();"; |
623 dont_fork_popup += "w.document.location=\""; | 623 dont_fork_popup += "w.document.location=\""; |
624 dont_fork_popup += https_url.spec(); | 624 dont_fork_popup += https_url.spec(); |
625 dont_fork_popup += "\";"; | 625 dont_fork_popup += "\";"; |
626 | 626 |
627 ui_test_utils::WindowedNotificationObserver popup_observer( | 627 ui_test_utils::WindowedNotificationObserver popup_observer( |
628 content::NOTIFICATION_TAB_ADDED, | 628 chrome::NOTIFICATION_TAB_ADDED, |
629 content::NotificationService::AllSources()); | 629 content::NotificationService::AllSources()); |
630 ui_test_utils::WindowedNotificationObserver nav_observer( | 630 ui_test_utils::WindowedNotificationObserver nav_observer( |
631 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 631 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
632 content::NotificationService::AllSources()); | 632 content::NotificationService::AllSources()); |
633 oldtab->GetRenderViewHost()-> | 633 oldtab->GetRenderViewHost()-> |
634 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(dont_fork_popup)); | 634 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(dont_fork_popup)); |
635 | 635 |
636 // Wait for popup window to appear and finish navigating. | 636 // Wait for popup window to appear and finish navigating. |
637 popup_observer.Wait(); | 637 popup_observer.Wait(); |
638 ASSERT_EQ(2, browser()->tab_count()); | 638 ASSERT_EQ(2, browser()->tab_count()); |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 | 1743 |
1744 // The normal browser should now have four. | 1744 // The normal browser should now have four. |
1745 EXPECT_EQ(4, browser()->tab_count()); | 1745 EXPECT_EQ(4, browser()->tab_count()); |
1746 | 1746 |
1747 // Close the additional browsers. | 1747 // Close the additional browsers. |
1748 popup_browser->CloseAllTabs(); | 1748 popup_browser->CloseAllTabs(); |
1749 app_browser->CloseAllTabs(); | 1749 app_browser->CloseAllTabs(); |
1750 app_popup_browser->CloseAllTabs(); | 1750 app_popup_browser->CloseAllTabs(); |
1751 } | 1751 } |
1752 #endif | 1752 #endif |
OLD | NEW |