| 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 "chrome/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 9 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 using content::WebContents; | 34 using content::WebContents; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 GURL GetGoogleURL() { | 38 GURL GetGoogleURL() { |
| 39 return GURL("http://www.google.com/"); | 39 return GURL("http://www.google.com/"); |
| 40 } | 40 } |
| 41 | 41 |
| 42 GURL GetSettingsURL() { | 42 GURL GetSettingsURL() { |
| 43 return GURL(chrome::kChromeUIUberURL).Resolve( | 43 return GURL(chrome::kChromeUISettingsURL); |
| 44 chrome::kChromeUISettingsHost + std::string("/")); | |
| 45 } | 44 } |
| 46 | 45 |
| 47 GURL GetContentSettingsURL() { | 46 GURL GetContentSettingsURL() { |
| 48 return GetSettingsURL().Resolve(chrome::kContentSettingsExceptionsSubPage); | 47 return GetSettingsURL().Resolve(chrome::kContentSettingsExceptionsSubPage); |
| 49 } | 48 } |
| 50 | 49 |
| 51 GURL GetClearBrowsingDataURL() { | 50 GURL GetClearBrowsingDataURL() { |
| 52 return GetSettingsURL().Resolve(chrome::kClearBrowserDataSubPage); | 51 return GetSettingsURL().Resolve(chrome::kClearBrowserDataSubPage); |
| 53 } | 52 } |
| 54 | 53 |
| 54 // Converts long uber URLs ("chrome://chrome/foo/") to short (virtual) URLs |
| 55 // ("chrome://foo/"). This should be used to convert the return value of |
| 56 // WebContentsImpl::GetURL before comparison because it can return either the |
| 57 // real URL or the virtual URL. |
| 58 GURL ShortenUberURL(const GURL& url) { |
| 59 std::string url_string = url.spec(); |
| 60 const std::string long_prefix = "chrome://chrome/"; |
| 61 const std::string short_prefix = "chrome://"; |
| 62 if (url_string.find(long_prefix) != 0) |
| 63 return url; |
| 64 url_string.replace(0, long_prefix.length(), short_prefix); |
| 65 return GURL(url_string); |
| 66 } |
| 67 |
| 55 } // namespace | 68 } // namespace |
| 56 | 69 |
| 57 chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams() const { | 70 chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams() const { |
| 58 return MakeNavigateParams(browser()); | 71 return MakeNavigateParams(browser()); |
| 59 } | 72 } |
| 60 | 73 |
| 61 chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams( | 74 chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams( |
| 62 Browser* browser) const { | 75 Browser* browser) const { |
| 63 chrome::NavigateParams params(browser, GetGoogleURL(), | 76 chrome::NavigateParams params(browser, GetGoogleURL(), |
| 64 content::PAGE_TRANSITION_LINK); | 77 content::PAGE_TRANSITION_LINK); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 728 p.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 716 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 729 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
| 717 chrome::Navigate(&p); | 730 chrome::Navigate(&p); |
| 718 | 731 |
| 719 // The last tab should now be selected and navigated to the sub-page of the | 732 // The last tab should now be selected and navigated to the sub-page of the |
| 720 // URL. | 733 // URL. |
| 721 EXPECT_EQ(browser(), p.browser); | 734 EXPECT_EQ(browser(), p.browser); |
| 722 EXPECT_EQ(3, browser()->tab_count()); | 735 EXPECT_EQ(3, browser()->tab_count()); |
| 723 EXPECT_EQ(2, browser()->active_index()); | 736 EXPECT_EQ(2, browser()->active_index()); |
| 724 EXPECT_EQ(GetContentSettingsURL(), | 737 EXPECT_EQ(GetContentSettingsURL(), |
| 725 chrome::GetActiveWebContents(browser())->GetURL()); | 738 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 726 } | 739 } |
| 727 | 740 |
| 728 // This test verifies that constructing params with disposition = SINGLETON_TAB | 741 // This test verifies that constructing params with disposition = SINGLETON_TAB |
| 729 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus | 742 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus |
| 730 // the path) which is navigated to the specified URL. | 743 // the path) which is navigated to the specified URL. |
| 731 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 744 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 732 Disposition_SingletonTabExisting_IgnorePath) { | 745 Disposition_SingletonTabExisting_IgnorePath) { |
| 733 GURL singleton_url1(GetSettingsURL()); | 746 GURL singleton_url1(GetSettingsURL()); |
| 734 chrome::AddSelectedTabWithURL(browser(), singleton_url1, | 747 chrome::AddSelectedTabWithURL(browser(), singleton_url1, |
| 735 content::PAGE_TRANSITION_LINK); | 748 content::PAGE_TRANSITION_LINK); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 748 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 761 p.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 749 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 762 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
| 750 chrome::Navigate(&p); | 763 chrome::Navigate(&p); |
| 751 | 764 |
| 752 // The middle tab should now be selected and navigated to the sub-page of the | 765 // The middle tab should now be selected and navigated to the sub-page of the |
| 753 // URL. | 766 // URL. |
| 754 EXPECT_EQ(browser(), p.browser); | 767 EXPECT_EQ(browser(), p.browser); |
| 755 EXPECT_EQ(3, browser()->tab_count()); | 768 EXPECT_EQ(3, browser()->tab_count()); |
| 756 EXPECT_EQ(1, browser()->active_index()); | 769 EXPECT_EQ(1, browser()->active_index()); |
| 757 EXPECT_EQ(GetContentSettingsURL(), | 770 EXPECT_EQ(GetContentSettingsURL(), |
| 758 chrome::GetActiveWebContents(browser())->GetURL()); | 771 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 759 } | 772 } |
| 760 | 773 |
| 761 // This test verifies that constructing params with disposition = SINGLETON_TAB | 774 // This test verifies that constructing params with disposition = SINGLETON_TAB |
| 762 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus | 775 // and IGNORE_AND_NAVIGATE opens an existing tab with the matching URL (minus |
| 763 // the path) which is navigated to the specified URL. | 776 // the path) which is navigated to the specified URL. |
| 764 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 777 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 765 Disposition_SingletonTabExistingSubPath_IgnorePath) { | 778 Disposition_SingletonTabExistingSubPath_IgnorePath) { |
| 766 GURL singleton_url1(GetContentSettingsURL()); | 779 GURL singleton_url1(GetContentSettingsURL()); |
| 767 chrome::AddSelectedTabWithURL(browser(), singleton_url1, | 780 chrome::AddSelectedTabWithURL(browser(), singleton_url1, |
| 768 content::PAGE_TRANSITION_LINK); | 781 content::PAGE_TRANSITION_LINK); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 781 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 794 p.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 782 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 795 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
| 783 chrome::Navigate(&p); | 796 chrome::Navigate(&p); |
| 784 | 797 |
| 785 // The middle tab should now be selected and navigated to the sub-page of the | 798 // The middle tab should now be selected and navigated to the sub-page of the |
| 786 // URL. | 799 // URL. |
| 787 EXPECT_EQ(browser(), p.browser); | 800 EXPECT_EQ(browser(), p.browser); |
| 788 EXPECT_EQ(3, browser()->tab_count()); | 801 EXPECT_EQ(3, browser()->tab_count()); |
| 789 EXPECT_EQ(1, browser()->active_index()); | 802 EXPECT_EQ(1, browser()->active_index()); |
| 790 EXPECT_EQ(GetClearBrowsingDataURL(), | 803 EXPECT_EQ(GetClearBrowsingDataURL(), |
| 791 chrome::GetActiveWebContents(browser())->GetURL()); | 804 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 792 } | 805 } |
| 793 | 806 |
| 794 // This test verifies that constructing params with disposition = SINGLETON_TAB | 807 // This test verifies that constructing params with disposition = SINGLETON_TAB |
| 795 // and IGNORE_AND_STAY_PUT opens an existing tab with the matching URL (minus | 808 // and IGNORE_AND_STAY_PUT opens an existing tab with the matching URL (minus |
| 796 // the path). | 809 // the path). |
| 797 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 810 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 798 Disposition_SingletonTabExistingSubPath_IgnorePath2) { | 811 Disposition_SingletonTabExistingSubPath_IgnorePath2) { |
| 799 GURL singleton_url1(GetContentSettingsURL()); | 812 GURL singleton_url1(GetContentSettingsURL()); |
| 800 chrome::AddSelectedTabWithURL(browser(), singleton_url1, | 813 chrome::AddSelectedTabWithURL(browser(), singleton_url1, |
| 801 content::PAGE_TRANSITION_LINK); | 814 content::PAGE_TRANSITION_LINK); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 813 p.url = GetClearBrowsingDataURL(); | 826 p.url = GetClearBrowsingDataURL(); |
| 814 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 827 p.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 815 p.path_behavior = chrome::NavigateParams::IGNORE_AND_STAY_PUT; | 828 p.path_behavior = chrome::NavigateParams::IGNORE_AND_STAY_PUT; |
| 816 chrome::Navigate(&p); | 829 chrome::Navigate(&p); |
| 817 | 830 |
| 818 // The middle tab should now be selected. | 831 // The middle tab should now be selected. |
| 819 EXPECT_EQ(browser(), p.browser); | 832 EXPECT_EQ(browser(), p.browser); |
| 820 EXPECT_EQ(3, browser()->tab_count()); | 833 EXPECT_EQ(3, browser()->tab_count()); |
| 821 EXPECT_EQ(1, browser()->active_index()); | 834 EXPECT_EQ(1, browser()->active_index()); |
| 822 EXPECT_EQ(singleton_url1, | 835 EXPECT_EQ(singleton_url1, |
| 823 chrome::GetActiveWebContents(browser())->GetURL()); | 836 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 824 } | 837 } |
| 825 | 838 |
| 826 // This test verifies that constructing params with disposition = SINGLETON_TAB | 839 // This test verifies that constructing params with disposition = SINGLETON_TAB |
| 827 // and IGNORE_AND_NAVIGATE will update the current tab's URL if the currently | 840 // and IGNORE_AND_NAVIGATE will update the current tab's URL if the currently |
| 828 // selected tab is a match but has a different path. | 841 // selected tab is a match but has a different path. |
| 829 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 842 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 830 Disposition_SingletonTabFocused_IgnorePath) { | 843 Disposition_SingletonTabFocused_IgnorePath) { |
| 831 GURL singleton_url_current(GetContentSettingsURL()); | 844 GURL singleton_url_current(GetContentSettingsURL()); |
| 832 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, | 845 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, |
| 833 content::PAGE_TRANSITION_LINK); | 846 content::PAGE_TRANSITION_LINK); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 844 p.url = singleton_url_target; | 857 p.url = singleton_url_target; |
| 845 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 858 p.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 846 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 859 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
| 847 chrome::Navigate(&p); | 860 chrome::Navigate(&p); |
| 848 | 861 |
| 849 // The second tab should still be selected, but navigated to the new path. | 862 // The second tab should still be selected, but navigated to the new path. |
| 850 EXPECT_EQ(browser(), p.browser); | 863 EXPECT_EQ(browser(), p.browser); |
| 851 EXPECT_EQ(2, browser()->tab_count()); | 864 EXPECT_EQ(2, browser()->tab_count()); |
| 852 EXPECT_EQ(1, browser()->active_index()); | 865 EXPECT_EQ(1, browser()->active_index()); |
| 853 EXPECT_EQ(singleton_url_target, | 866 EXPECT_EQ(singleton_url_target, |
| 854 chrome::GetActiveWebContents(browser())->GetURL()); | 867 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 855 } | 868 } |
| 856 | 869 |
| 857 // This test verifies that constructing params with disposition = SINGLETON_TAB | 870 // This test verifies that constructing params with disposition = SINGLETON_TAB |
| 858 // and IGNORE_AND_NAVIGATE will open an existing matching tab with a different | 871 // and IGNORE_AND_NAVIGATE will open an existing matching tab with a different |
| 859 // query. | 872 // query. |
| 860 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 873 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 861 Disposition_SingletonTabExisting_IgnoreQuery) { | 874 Disposition_SingletonTabExisting_IgnoreQuery) { |
| 862 int initial_tab_count = browser()->tab_count(); | 875 int initial_tab_count = browser()->tab_count(); |
| 863 GURL singleton_url_current("chrome://settings/internet"); | 876 GURL singleton_url_current("chrome://settings/internet"); |
| 864 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, | 877 chrome::AddSelectedTabWithURL(browser(), singleton_url_current, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 { | 916 { |
| 904 content::WindowedNotificationObserver observer( | 917 content::WindowedNotificationObserver observer( |
| 905 content::NOTIFICATION_LOAD_STOP, | 918 content::NOTIFICATION_LOAD_STOP, |
| 906 content::NotificationService::AllSources()); | 919 content::NotificationService::AllSources()); |
| 907 chrome::Navigate(¶ms); | 920 chrome::Navigate(¶ms); |
| 908 observer.Wait(); | 921 observer.Wait(); |
| 909 } | 922 } |
| 910 | 923 |
| 911 EXPECT_EQ(1u, BrowserList::size()); | 924 EXPECT_EQ(1u, BrowserList::size()); |
| 912 EXPECT_EQ(GetSettingsURL(), | 925 EXPECT_EQ(GetSettingsURL(), |
| 913 chrome::GetActiveWebContents(browser())->GetURL()); | 926 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 914 } | 927 } |
| 915 | 928 |
| 916 // Settings page is expected to always open in normal mode regardless | 929 // Settings page is expected to always open in normal mode regardless |
| 917 // of whether the user is trying to open it in incognito mode or not. | 930 // of whether the user is trying to open it in incognito mode or not. |
| 918 // This test verifies that if incognito mode is forced (by policy), settings | 931 // This test verifies that if incognito mode is forced (by policy), settings |
| 919 // page doesn't open at all. | 932 // page doesn't open at all. |
| 920 // Disabled until fixed for uber settings: http://crbug.com/111243 | 933 // Disabled until fixed for uber settings: http://crbug.com/111243 |
| 921 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 934 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 922 DISABLED_Disposition_Settings_DoNothingIfIncognitoIsForced) { | 935 DISABLED_Disposition_Settings_DoNothingIfIncognitoIsForced) { |
| 923 RunDoNothingIfIncognitoIsForcedTest(GetSettingsURL()); | 936 RunDoNothingIfIncognitoIsForcedTest(GetSettingsURL()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 NavigateFromDefaultToOptionsInSameTab) { | 1000 NavigateFromDefaultToOptionsInSameTab) { |
| 988 { | 1001 { |
| 989 content::WindowedNotificationObserver observer( | 1002 content::WindowedNotificationObserver observer( |
| 990 content::NOTIFICATION_LOAD_STOP, | 1003 content::NOTIFICATION_LOAD_STOP, |
| 991 content::NotificationService::AllSources()); | 1004 content::NotificationService::AllSources()); |
| 992 chrome::ShowSettings(browser()); | 1005 chrome::ShowSettings(browser()); |
| 993 observer.Wait(); | 1006 observer.Wait(); |
| 994 } | 1007 } |
| 995 EXPECT_EQ(1, browser()->tab_count()); | 1008 EXPECT_EQ(1, browser()->tab_count()); |
| 996 EXPECT_EQ(GetSettingsURL(), | 1009 EXPECT_EQ(GetSettingsURL(), |
| 997 chrome::GetActiveWebContents(browser())->GetURL()); | 1010 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 998 } | 1011 } |
| 999 | 1012 |
| 1000 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1013 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1001 NavigateFromBlankToOptionsInSameTab) { | 1014 NavigateFromBlankToOptionsInSameTab) { |
| 1002 chrome::NavigateParams p(MakeNavigateParams()); | 1015 chrome::NavigateParams p(MakeNavigateParams()); |
| 1003 p.url = GURL(chrome::kAboutBlankURL); | 1016 p.url = GURL(chrome::kAboutBlankURL); |
| 1004 ui_test_utils::NavigateToURL(&p); | 1017 ui_test_utils::NavigateToURL(&p); |
| 1005 | 1018 |
| 1006 { | 1019 { |
| 1007 content::WindowedNotificationObserver observer( | 1020 content::WindowedNotificationObserver observer( |
| 1008 content::NOTIFICATION_LOAD_STOP, | 1021 content::NOTIFICATION_LOAD_STOP, |
| 1009 content::NotificationService::AllSources()); | 1022 content::NotificationService::AllSources()); |
| 1010 chrome::ShowSettings(browser()); | 1023 chrome::ShowSettings(browser()); |
| 1011 observer.Wait(); | 1024 observer.Wait(); |
| 1012 } | 1025 } |
| 1013 EXPECT_EQ(1, browser()->tab_count()); | 1026 EXPECT_EQ(1, browser()->tab_count()); |
| 1014 EXPECT_EQ(GetSettingsURL(), | 1027 EXPECT_EQ(GetSettingsURL(), |
| 1015 chrome::GetActiveWebContents(browser())->GetURL()); | 1028 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 1016 } | 1029 } |
| 1017 | 1030 |
| 1018 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1031 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1019 NavigateFromNTPToOptionsInSameTab) { | 1032 NavigateFromNTPToOptionsInSameTab) { |
| 1020 chrome::NavigateParams p(MakeNavigateParams()); | 1033 chrome::NavigateParams p(MakeNavigateParams()); |
| 1021 p.url = GURL(chrome::kChromeUINewTabURL); | 1034 p.url = GURL(chrome::kChromeUINewTabURL); |
| 1022 ui_test_utils::NavigateToURL(&p); | 1035 ui_test_utils::NavigateToURL(&p); |
| 1023 EXPECT_EQ(1, browser()->tab_count()); | 1036 EXPECT_EQ(1, browser()->tab_count()); |
| 1024 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 1037 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
| 1025 chrome::GetActiveWebContents(browser())->GetURL()); | 1038 chrome::GetActiveWebContents(browser())->GetURL()); |
| 1026 | 1039 |
| 1027 { | 1040 { |
| 1028 content::WindowedNotificationObserver observer( | 1041 content::WindowedNotificationObserver observer( |
| 1029 content::NOTIFICATION_LOAD_STOP, | 1042 content::NOTIFICATION_LOAD_STOP, |
| 1030 content::NotificationService::AllSources()); | 1043 content::NotificationService::AllSources()); |
| 1031 chrome::ShowSettings(browser()); | 1044 chrome::ShowSettings(browser()); |
| 1032 observer.Wait(); | 1045 observer.Wait(); |
| 1033 } | 1046 } |
| 1034 EXPECT_EQ(1, browser()->tab_count()); | 1047 EXPECT_EQ(1, browser()->tab_count()); |
| 1035 EXPECT_EQ(GetSettingsURL(), | 1048 EXPECT_EQ(GetSettingsURL(), |
| 1036 chrome::GetActiveWebContents(browser())->GetURL()); | 1049 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 1037 } | 1050 } |
| 1038 | 1051 |
| 1039 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1052 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1040 NavigateFromPageToOptionsInNewTab) { | 1053 NavigateFromPageToOptionsInNewTab) { |
| 1041 chrome::NavigateParams p(MakeNavigateParams()); | 1054 chrome::NavigateParams p(MakeNavigateParams()); |
| 1042 ui_test_utils::NavigateToURL(&p); | 1055 ui_test_utils::NavigateToURL(&p); |
| 1043 EXPECT_EQ(GetGoogleURL(), chrome::GetActiveWebContents(browser())->GetURL()); | 1056 EXPECT_EQ(GetGoogleURL(), chrome::GetActiveWebContents(browser())->GetURL()); |
| 1044 EXPECT_EQ(1u, BrowserList::size()); | 1057 EXPECT_EQ(1u, BrowserList::size()); |
| 1045 EXPECT_EQ(1, browser()->tab_count()); | 1058 EXPECT_EQ(1, browser()->tab_count()); |
| 1046 | 1059 |
| 1047 { | 1060 { |
| 1048 content::WindowedNotificationObserver observer( | 1061 content::WindowedNotificationObserver observer( |
| 1049 content::NOTIFICATION_LOAD_STOP, | 1062 content::NOTIFICATION_LOAD_STOP, |
| 1050 content::NotificationService::AllSources()); | 1063 content::NotificationService::AllSources()); |
| 1051 chrome::ShowSettings(browser()); | 1064 chrome::ShowSettings(browser()); |
| 1052 observer.Wait(); | 1065 observer.Wait(); |
| 1053 } | 1066 } |
| 1054 EXPECT_EQ(2, browser()->tab_count()); | 1067 EXPECT_EQ(2, browser()->tab_count()); |
| 1055 EXPECT_EQ(GetSettingsURL(), | 1068 EXPECT_EQ(GetSettingsURL(), |
| 1056 chrome::GetActiveWebContents(browser())->GetURL()); | 1069 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 1057 } | 1070 } |
| 1058 | 1071 |
| 1059 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1072 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1060 NavigateFromNTPToOptionsSingleton) { | 1073 NavigateFromNTPToOptionsSingleton) { |
| 1061 { | 1074 { |
| 1062 content::WindowedNotificationObserver observer( | 1075 content::WindowedNotificationObserver observer( |
| 1063 content::NOTIFICATION_LOAD_STOP, | 1076 content::NOTIFICATION_LOAD_STOP, |
| 1064 content::NotificationService::AllSources()); | 1077 content::NotificationService::AllSources()); |
| 1065 chrome::ShowSettings(browser()); | 1078 chrome::ShowSettings(browser()); |
| 1066 observer.Wait(); | 1079 observer.Wait(); |
| 1067 } | 1080 } |
| 1068 EXPECT_EQ(1, browser()->tab_count()); | 1081 EXPECT_EQ(1, browser()->tab_count()); |
| 1069 | 1082 |
| 1070 chrome::NewTab(browser()); | 1083 chrome::NewTab(browser()); |
| 1071 EXPECT_EQ(2, browser()->tab_count()); | 1084 EXPECT_EQ(2, browser()->tab_count()); |
| 1072 | 1085 |
| 1073 { | 1086 { |
| 1074 content::WindowedNotificationObserver observer( | 1087 content::WindowedNotificationObserver observer( |
| 1075 content::NOTIFICATION_LOAD_STOP, | 1088 content::NOTIFICATION_LOAD_STOP, |
| 1076 content::NotificationService::AllSources()); | 1089 content::NotificationService::AllSources()); |
| 1077 chrome::ShowSettings(browser()); | 1090 chrome::ShowSettings(browser()); |
| 1078 observer.Wait(); | 1091 observer.Wait(); |
| 1079 } | 1092 } |
| 1080 EXPECT_EQ(2, browser()->tab_count()); | 1093 EXPECT_EQ(2, browser()->tab_count()); |
| 1081 EXPECT_EQ(GetSettingsURL(), | 1094 EXPECT_EQ(GetSettingsURL(), |
| 1082 chrome::GetActiveWebContents(browser())->GetURL()); | 1095 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 1083 } | 1096 } |
| 1084 | 1097 |
| 1085 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1098 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1086 NavigateFromNTPToOptionsPageInSameTab) { | 1099 NavigateFromNTPToOptionsPageInSameTab) { |
| 1087 { | 1100 { |
| 1088 content::WindowedNotificationObserver observer( | 1101 content::WindowedNotificationObserver observer( |
| 1089 content::NOTIFICATION_LOAD_STOP, | 1102 content::NOTIFICATION_LOAD_STOP, |
| 1090 content::NotificationService::AllSources()); | 1103 content::NotificationService::AllSources()); |
| 1091 chrome::ShowClearBrowsingDataDialog(browser()); | 1104 chrome::ShowClearBrowsingDataDialog(browser()); |
| 1092 observer.Wait(); | 1105 observer.Wait(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 | 1150 |
| 1138 { | 1151 { |
| 1139 content::WindowedNotificationObserver observer( | 1152 content::WindowedNotificationObserver observer( |
| 1140 content::NOTIFICATION_LOAD_STOP, | 1153 content::NOTIFICATION_LOAD_STOP, |
| 1141 content::NotificationService::AllSources()); | 1154 content::NotificationService::AllSources()); |
| 1142 chrome::ShowSettings(browser()); | 1155 chrome::ShowSettings(browser()); |
| 1143 observer.Wait(); | 1156 observer.Wait(); |
| 1144 } | 1157 } |
| 1145 EXPECT_EQ(2, browser()->tab_count()); | 1158 EXPECT_EQ(2, browser()->tab_count()); |
| 1146 EXPECT_EQ(GetSettingsURL(), | 1159 EXPECT_EQ(GetSettingsURL(), |
| 1147 chrome::GetActiveWebContents(browser())->GetURL()); | 1160 ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL())); |
| 1148 } | 1161 } |
| 1149 | 1162 |
| 1150 // Tests that when a new tab is opened from the omnibox, the focus is moved from | 1163 // Tests that when a new tab is opened from the omnibox, the focus is moved from |
| 1151 // the omnibox for the current tab. | 1164 // the omnibox for the current tab. |
| 1152 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, | 1165 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1153 NavigateFromOmniboxIntoNewTab) { | 1166 NavigateFromOmniboxIntoNewTab) { |
| 1154 GURL url("http://www.google.com/"); | 1167 GURL url("http://www.google.com/"); |
| 1155 GURL url2("http://maps.google.com/"); | 1168 GURL url2("http://maps.google.com/"); |
| 1156 | 1169 |
| 1157 // Navigate to url. | 1170 // Navigate to url. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 // Now navigate using the incognito profile and check that a new window | 1252 // Now navigate using the incognito profile and check that a new window |
| 1240 // is created. | 1253 // is created. |
| 1241 chrome::NavigateParams params_incognito( | 1254 chrome::NavigateParams params_incognito( |
| 1242 browser()->profile()->GetOffTheRecordProfile(), | 1255 browser()->profile()->GetOffTheRecordProfile(), |
| 1243 GetGoogleURL(), content::PAGE_TRANSITION_LINK); | 1256 GetGoogleURL(), content::PAGE_TRANSITION_LINK); |
| 1244 ui_test_utils::NavigateToURL(¶ms_incognito); | 1257 ui_test_utils::NavigateToURL(¶ms_incognito); |
| 1245 EXPECT_EQ(2u, BrowserList::size()); | 1258 EXPECT_EQ(2u, BrowserList::size()); |
| 1246 } | 1259 } |
| 1247 | 1260 |
| 1248 } // namespace | 1261 } // namespace |
| OLD | NEW |