| 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 string16 title_before_crash; | 42 string16 title_before_crash; |
| 43 string16 title_after_crash; | 43 string16 title_after_crash; |
| 44 | 44 |
| 45 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 45 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 46 &title_before_crash)); | 46 &title_before_crash)); |
| 47 SimulateRendererCrash(browser()); | 47 SimulateRendererCrash(browser()); |
| 48 ui_test_utils::WindowedNotificationObserver observer( | 48 ui_test_utils::WindowedNotificationObserver observer( |
| 49 content::NOTIFICATION_LOAD_STOP, | 49 content::NOTIFICATION_LOAD_STOP, |
| 50 content::Source<NavigationController>( | 50 content::Source<NavigationController>( |
| 51 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> | 51 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> |
| 52 GetController())); | 52 controller())); |
| 53 browser()->Reload(CURRENT_TAB); | 53 browser()->Reload(CURRENT_TAB); |
| 54 observer.Wait(); | 54 observer.Wait(); |
| 55 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 55 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 56 &title_after_crash)); | 56 &title_after_crash)); |
| 57 EXPECT_NE(title_before_crash, title_after_crash); | 57 EXPECT_NE(title_before_crash, title_after_crash); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Tests that loading a crashed page in a new tab correctly updates the title. | 60 // Tests that loading a crashed page in a new tab correctly updates the title. |
| 61 // There was an earlier bug (1270510) in process-per-site in which the max page | 61 // There was an earlier bug (1270510) in process-per-site in which the max page |
| 62 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab | 62 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab |
| 63 // was not committed. This prevents regression of that bug. | 63 // was not committed. This prevents regression of that bug. |
| 64 // http://crbug.com/57158 - Times out sometimes on all platforms. | 64 // http://crbug.com/57158 - Times out sometimes on all platforms. |
| 65 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { | 65 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { |
| 66 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); | 66 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); |
| 67 | 67 |
| 68 ui_test_utils::NavigateToURL(browser(), | 68 ui_test_utils::NavigateToURL(browser(), |
| 69 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 69 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 70 FilePath(kTitle2File))); | 70 FilePath(kTitle2File))); |
| 71 | 71 |
| 72 string16 title_before_crash; | 72 string16 title_before_crash; |
| 73 string16 title_after_crash; | 73 string16 title_after_crash; |
| 74 | 74 |
| 75 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 75 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 76 &title_before_crash)); | 76 &title_before_crash)); |
| 77 SimulateRendererCrash(browser()); | 77 SimulateRendererCrash(browser()); |
| 78 ui_test_utils::WindowedNotificationObserver observer( | 78 ui_test_utils::WindowedNotificationObserver observer( |
| 79 content::NOTIFICATION_LOAD_STOP, | 79 content::NOTIFICATION_LOAD_STOP, |
| 80 content::Source<NavigationController>( | 80 content::Source<NavigationController>( |
| 81 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> | 81 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> |
| 82 GetController())); | 82 controller())); |
| 83 browser()->Reload(CURRENT_TAB); | 83 browser()->Reload(CURRENT_TAB); |
| 84 observer.Wait(); | 84 observer.Wait(); |
| 85 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 85 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 86 &title_after_crash)); | 86 &title_after_crash)); |
| 87 EXPECT_EQ(title_before_crash, title_after_crash); | 87 EXPECT_EQ(title_before_crash, title_after_crash); |
| 88 } | 88 } |
| OLD | NEW |