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