OLD | NEW |
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 "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/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 browser::Navigate(&p); | 827 browser::Navigate(&p); |
828 | 828 |
829 // The bookmarks page should be opened in browser() window. | 829 // The bookmarks page should be opened in browser() window. |
830 EXPECT_NE(incognito_browser, p.browser); | 830 EXPECT_NE(incognito_browser, p.browser); |
831 EXPECT_EQ(browser(), p.browser); | 831 EXPECT_EQ(browser(), p.browser); |
832 EXPECT_EQ(2, browser()->tab_count()); | 832 EXPECT_EQ(2, browser()->tab_count()); |
833 EXPECT_EQ(GURL("chrome://bookmarks"), | 833 EXPECT_EQ(GURL("chrome://bookmarks"), |
834 browser()->GetSelectedTabContents()->GetURL()); | 834 browser()->GetSelectedTabContents()->GetURL()); |
835 } | 835 } |
836 | 836 |
| 837 // This test makes sure a crashed singleton tab reloads from a new navigation. |
| 838 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 839 NavigateToCrashedSingletonTab) { |
| 840 GURL singleton_url("chrome://settings/advanced"); |
| 841 TabContentsWrapper* wrapper = |
| 842 browser()->AddSelectedTabWithURL(singleton_url, PageTransition::LINK); |
| 843 TabContents* tab_contents = wrapper->tab_contents(); |
| 844 |
| 845 // We should have one browser with 2 tabs, the 2nd selected. |
| 846 EXPECT_EQ(1u, BrowserList::size()); |
| 847 EXPECT_EQ(2, browser()->tab_count()); |
| 848 EXPECT_EQ(1, browser()->active_index()); |
| 849 |
| 850 // Kill the singleton tab. |
| 851 tab_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); |
| 852 EXPECT_TRUE(tab_contents->is_crashed()); |
| 853 |
| 854 browser::NavigateParams p(MakeNavigateParams()); |
| 855 p.disposition = SINGLETON_TAB; |
| 856 p.url = singleton_url; |
| 857 p.window_action = browser::NavigateParams::SHOW_WINDOW; |
| 858 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; |
| 859 browser::Navigate(&p); |
| 860 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 861 |
| 862 // The tab should not be sad anymore. |
| 863 EXPECT_FALSE(tab_contents->is_crashed()); |
| 864 } |
| 865 |
837 } // namespace | 866 } // namespace |
OLD | NEW |