| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 6 #include "chrome/browser/browser.h" |
| 7 #include "chrome/browser/tab_contents/navigation_entry.h" | 7 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "chrome/browser/tab_contents/tab_contents.h" |
| 9 #include "chrome/common/notification_type.h" | 9 #include "chrome/common/notification_type.h" |
| 10 #include "chrome/common/page_transition_types.h" | 10 #include "chrome/common/page_transition_types.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 GURL url( | 44 GURL url( |
| 45 "data:text/html,<script>document.title=new Date().valueOf()</script>"); | 45 "data:text/html,<script>document.title=new Date().valueOf()</script>"); |
| 46 ui_test_utils::NavigateToURL(browser(), url); | 46 ui_test_utils::NavigateToURL(browser(), url); |
| 47 | 47 |
| 48 string16 title_before_crash; | 48 string16 title_before_crash; |
| 49 string16 title_after_crash; | 49 string16 title_after_crash; |
| 50 | 50 |
| 51 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 51 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 52 &title_before_crash)); | 52 &title_before_crash)); |
| 53 SimulateRendererCrash(browser()); | 53 SimulateRendererCrash(browser()); |
| 54 browser()->Reload(); | 54 browser()->Reload(CURRENT_TAB); |
| 55 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 55 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 56 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 56 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 57 &title_after_crash)); | 57 &title_after_crash)); |
| 58 EXPECT_NE(title_before_crash, title_after_crash); | 58 EXPECT_NE(title_before_crash, title_after_crash); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Tests that loading a crashed page in a new tab correctly updates the title. | 61 // Tests that loading a crashed page in a new tab correctly updates the title. |
| 62 // There was an earlier bug (1270510) in process-per-site in which the max page | 62 // There was an earlier bug (1270510) in process-per-site in which the max page |
| 63 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab | 63 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab |
| 64 // was not committed. This prevents regression of that bug. | 64 // was not committed. This prevents regression of that bug. |
| 65 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, MAYBE_LoadInNewTab) { | 65 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, MAYBE_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 browser()->Reload(); | 78 browser()->Reload(CURRENT_TAB); |
| 79 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 79 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 80 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 80 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 81 &title_after_crash)); | 81 &title_after_crash)); |
| 82 EXPECT_EQ(title_before_crash, title_after_crash); | 82 EXPECT_EQ(title_before_crash, title_after_crash); |
| 83 } | 83 } |
| OLD | NEW |