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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_tab_contents.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) 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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 CommandLine::ForCurrentProcess()->AppendSwitch( 551 CommandLine::ForCurrentProcess()->AppendSwitch(
552 switches::kDisablePopupBlocking); 552 switches::kDisablePopupBlocking);
553 553
554 // Create http and https servers for a cross-site transition. 554 // Create http and https servers for a cross-site transition.
555 ASSERT_TRUE(test_server()->Start()); 555 ASSERT_TRUE(test_server()->Start());
556 net::TestServer https_test_server(net::TestServer::TYPE_HTTPS, 556 net::TestServer https_test_server(net::TestServer::TYPE_HTTPS,
557 net::TestServer::kLocalhost, 557 net::TestServer::kLocalhost,
558 base::FilePath(kDocRoot)); 558 base::FilePath(kDocRoot));
559 ASSERT_TRUE(https_test_server.Start()); 559 ASSERT_TRUE(https_test_server.Start());
560 GURL http_url(test_server()->GetURL("files/title1.html")); 560 GURL http_url(test_server()->GetURL("files/title1.html"));
561 GURL https_url(https_test_server.GetURL("")); 561 GURL https_url(https_test_server.GetURL(std::string()));
562 562
563 // Start with an http URL. 563 // Start with an http URL.
564 ui_test_utils::NavigateToURL(browser(), http_url); 564 ui_test_utils::NavigateToURL(browser(), http_url);
565 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents(); 565 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents();
566 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); 566 content::RenderProcessHost* process = oldtab->GetRenderProcessHost();
567 567
568 // Now open a tab to a blank page, set its opener to null, and redirect it 568 // Now open a tab to a blank page, set its opener to null, and redirect it
569 // cross-site. 569 // cross-site.
570 std::string redirect_popup = "w=window.open();"; 570 std::string redirect_popup = "w=window.open();";
571 redirect_popup += "w.opener=null;"; 571 redirect_popup += "w.opener=null;";
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 CommandLine::ForCurrentProcess()->AppendSwitch( 640 CommandLine::ForCurrentProcess()->AppendSwitch(
641 switches::kDisablePopupBlocking); 641 switches::kDisablePopupBlocking);
642 642
643 // Create http and https servers for a cross-site transition. 643 // Create http and https servers for a cross-site transition.
644 ASSERT_TRUE(test_server()->Start()); 644 ASSERT_TRUE(test_server()->Start());
645 net::TestServer https_test_server(net::TestServer::TYPE_HTTPS, 645 net::TestServer https_test_server(net::TestServer::TYPE_HTTPS,
646 net::TestServer::kLocalhost, 646 net::TestServer::kLocalhost,
647 base::FilePath(kDocRoot)); 647 base::FilePath(kDocRoot));
648 ASSERT_TRUE(https_test_server.Start()); 648 ASSERT_TRUE(https_test_server.Start());
649 GURL http_url(test_server()->GetURL("files/title1.html")); 649 GURL http_url(test_server()->GetURL("files/title1.html"));
650 GURL https_url(https_test_server.GetURL("")); 650 GURL https_url(https_test_server.GetURL(std::string()));
651 651
652 // Start with an http URL. 652 // Start with an http URL.
653 ui_test_utils::NavigateToURL(browser(), http_url); 653 ui_test_utils::NavigateToURL(browser(), http_url);
654 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents(); 654 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents();
655 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); 655 content::RenderProcessHost* process = oldtab->GetRenderProcessHost();
656 656
657 // Now open a tab to a blank page, set its opener to null, and redirect it 657 // Now open a tab to a blank page, set its opener to null, and redirect it
658 // cross-site. 658 // cross-site.
659 std::string dont_fork_popup = "w=window.open();"; 659 std::string dont_fork_popup = "w=window.open();";
660 dont_fork_popup += "w.document.location=\""; 660 dont_fork_popup += "w.document.location=\"";
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); 740 ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme));
741 ui_test_utils::NavigateToURL(browser(), file_url); 741 ui_test_utils::NavigateToURL(browser(), file_url);
742 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 742 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
743 } 743 }
744 744
745 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { 745 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) {
746 CommandUpdater* command_updater = 746 CommandUpdater* command_updater =
747 browser()->command_controller()->command_updater(); 747 browser()->command_controller()->command_updater();
748 748
749 ASSERT_TRUE(test_server()->Start()); 749 ASSERT_TRUE(test_server()->Start());
750 GURL http_url(test_server()->GetURL("")); 750 GURL http_url(test_server()->GetURL(std::string()));
751 ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); 751 ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme));
752 ui_test_utils::NavigateToURL(browser(), http_url); 752 ui_test_utils::NavigateToURL(browser(), http_url);
753 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 753 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
754 } 754 }
755 755
756 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { 756 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) {
757 CommandUpdater* command_updater = 757 CommandUpdater* command_updater =
758 browser()->command_controller()->command_updater(); 758 browser()->command_controller()->command_updater();
759 759
760 net::TestServer test_server(net::TestServer::TYPE_HTTPS, 760 net::TestServer test_server(net::TestServer::TYPE_HTTPS,
761 net::TestServer::kLocalhost, 761 net::TestServer::kLocalhost,
762 base::FilePath(kDocRoot)); 762 base::FilePath(kDocRoot));
763 ASSERT_TRUE(test_server.Start()); 763 ASSERT_TRUE(test_server.Start());
764 GURL https_url(test_server.GetURL("/")); 764 GURL https_url(test_server.GetURL("/"));
765 ASSERT_TRUE(https_url.SchemeIs(chrome::kHttpsScheme)); 765 ASSERT_TRUE(https_url.SchemeIs(chrome::kHttpsScheme));
766 ui_test_utils::NavigateToURL(browser(), https_url); 766 ui_test_utils::NavigateToURL(browser(), https_url);
767 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 767 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
768 } 768 }
769 769
770 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { 770 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) {
771 CommandUpdater* command_updater = 771 CommandUpdater* command_updater =
772 browser()->command_controller()->command_updater(); 772 browser()->command_controller()->command_updater();
773 773
774 net::TestServer test_server(net::TestServer::TYPE_FTP, 774 net::TestServer test_server(net::TestServer::TYPE_FTP,
775 net::TestServer::kLocalhost, 775 net::TestServer::kLocalhost,
776 base::FilePath(kDocRoot)); 776 base::FilePath(kDocRoot));
777 ASSERT_TRUE(test_server.Start()); 777 ASSERT_TRUE(test_server.Start());
778 GURL ftp_url(test_server.GetURL("")); 778 GURL ftp_url(test_server.GetURL(std::string()));
779 ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme)); 779 ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme));
780 ui_test_utils::NavigateToURL(browser(), ftp_url); 780 ui_test_utils::NavigateToURL(browser(), ftp_url);
781 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 781 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
782 } 782 }
783 783
784 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutInvalid) { 784 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutInvalid) {
785 CommandUpdater* command_updater = 785 CommandUpdater* command_updater =
786 browser()->command_controller()->command_updater(); 786 browser()->command_controller()->command_updater();
787 787
788 // Urls that should not have shortcuts. 788 // Urls that should not have shortcuts.
(...skipping 11 matching lines...) Expand all
800 800
801 GURL blank_url(chrome::kAboutBlankURL); 801 GURL blank_url(chrome::kAboutBlankURL);
802 ui_test_utils::NavigateToURL(browser(), blank_url); 802 ui_test_utils::NavigateToURL(browser(), blank_url);
803 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 803 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
804 } 804 }
805 805
806 // Change a tab into an application window. 806 // Change a tab into an application window.
807 // DISABLED: http://crbug.com/72310 807 // DISABLED: http://crbug.com/72310
808 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { 808 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) {
809 ASSERT_TRUE(test_server()->Start()); 809 ASSERT_TRUE(test_server()->Start());
810 GURL http_url(test_server()->GetURL("")); 810 GURL http_url(test_server()->GetURL(std::string()));
811 ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); 811 ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme));
812 812
813 ASSERT_EQ(1, browser()->tab_strip_model()->count()); 813 ASSERT_EQ(1, browser()->tab_strip_model()->count());
814 WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0); 814 WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0);
815 WebContents* app_tab = chrome::AddSelectedTabWithURL( 815 WebContents* app_tab = chrome::AddSelectedTabWithURL(
816 browser(), http_url, content::PAGE_TRANSITION_TYPED); 816 browser(), http_url, content::PAGE_TRANSITION_TYPED);
817 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 817 ASSERT_EQ(2, browser()->tab_strip_model()->count());
818 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 818 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
819 browser()->host_desktop_type())); 819 browser()->host_desktop_type()));
820 820
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); 2099 RunTest(browser(), GetHrefURL(), modifiers, button, disposition);
2100 } 2100 }
2101 2101
2102 // Shift-middle-clicks open in a foreground tab. 2102 // Shift-middle-clicks open in a foreground tab.
2103 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefShiftMiddleClickTest) { 2103 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefShiftMiddleClickTest) {
2104 int modifiers = WebKit::WebInputEvent::ShiftKey; 2104 int modifiers = WebKit::WebInputEvent::ShiftKey;
2105 WebKit::WebMouseEvent::Button button = WebKit::WebMouseEvent::ButtonMiddle; 2105 WebKit::WebMouseEvent::Button button = WebKit::WebMouseEvent::ButtonMiddle;
2106 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; 2106 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB;
2107 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); 2107 RunTest(browser(), GetHrefURL(), modifiers, button, disposition);
2108 } 2108 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698