| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 #include "chrome/browser/tab_contents/navigation_entry.h" | 6 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 7 #include "chrome/browser/tab_contents/tab_contents.h" | 7 #include "chrome/browser/tab_contents/tab_contents.h" |
| 8 #include "chrome/common/notification_registrar.h" | 8 #include "chrome/common/notification_registrar.h" |
| 9 #include "chrome/common/notification_service.h" | 9 #include "chrome/common/notification_service.h" |
| 10 #include "chrome/common/page_transition_types.h" | 10 #include "chrome/common/page_transition_types.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 PageTransition::TYPED); | 50 PageTransition::TYPED); |
| 51 RendererCrashObserver crash_observer; | 51 RendererCrashObserver crash_observer; |
| 52 crash_observer.WaitForRendererCrash(); | 52 crash_observer.WaitForRendererCrash(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 class CrashRecoveryBrowserTest : public InProcessBrowserTest { | 57 class CrashRecoveryBrowserTest : public InProcessBrowserTest { |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // http://crbug.com/29331 - Causes an OS crash dialog in release mode, needs to |
| 61 // be fixed before it can be enabled to not cause the bots issues. |
| 62 #if defined(OS_MACOSX) |
| 63 #define MAYBE_Reload DISABLED_Reload |
| 64 #define MAYBE_LoadInNewTab DISABLED_LoadInNewTab |
| 65 #else |
| 66 #define MAYBE_Reload Reload |
| 67 #define MAYBE_LoadInNewTab LoadInNewTab |
| 68 #endif |
| 69 |
| 60 // Test that reload works after a crash. | 70 // Test that reload works after a crash. |
| 61 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { | 71 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, MAYBE_Reload) { |
| 62 // The title of the active tab should change each time this URL is loaded. | 72 // The title of the active tab should change each time this URL is loaded. |
| 63 GURL url( | 73 GURL url( |
| 64 "data:text/html,<script>document.title=new Date().valueOf()</script>"); | 74 "data:text/html,<script>document.title=new Date().valueOf()</script>"); |
| 65 ui_test_utils::NavigateToURL(browser(), url); | 75 ui_test_utils::NavigateToURL(browser(), url); |
| 66 | 76 |
| 67 string16 title_before_crash; | 77 string16 title_before_crash; |
| 68 string16 title_after_crash; | 78 string16 title_after_crash; |
| 69 | 79 |
| 70 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 80 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 71 &title_before_crash)); | 81 &title_before_crash)); |
| 72 SimulateRendererCrash(browser()); | 82 SimulateRendererCrash(browser()); |
| 73 browser()->Reload(); | 83 browser()->Reload(); |
| 74 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 84 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 75 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 85 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 76 &title_after_crash)); | 86 &title_after_crash)); |
| 77 EXPECT_NE(title_before_crash, title_after_crash); | 87 EXPECT_NE(title_before_crash, title_after_crash); |
| 78 } | 88 } |
| 79 | 89 |
| 80 // Tests that loading a crashed page in a new tab correctly updates the title. | 90 // Tests that loading a crashed page in a new tab correctly updates the title. |
| 81 // There was an earlier bug (1270510) in process-per-site in which the max page | 91 // There was an earlier bug (1270510) in process-per-site in which the max page |
| 82 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab | 92 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab |
| 83 // was not committed. This prevents regression of that bug. | 93 // was not committed. This prevents regression of that bug. |
| 84 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { | 94 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, MAYBE_LoadInNewTab) { |
| 85 ui_test_utils::NavigateToURL(browser(), | 95 ui_test_utils::NavigateToURL(browser(), |
| 86 ui_test_utils::GetTestUrl(L".", L"title2.html")); | 96 ui_test_utils::GetTestUrl(L".", L"title2.html")); |
| 87 | 97 |
| 88 string16 title_before_crash; | 98 string16 title_before_crash; |
| 89 string16 title_after_crash; | 99 string16 title_after_crash; |
| 90 | 100 |
| 91 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 101 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 92 &title_before_crash)); | 102 &title_before_crash)); |
| 93 SimulateRendererCrash(browser()); | 103 SimulateRendererCrash(browser()); |
| 94 browser()->Reload(); | 104 browser()->Reload(); |
| 95 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 105 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 96 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 106 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 97 &title_after_crash)); | 107 &title_after_crash)); |
| 98 EXPECT_EQ(title_before_crash, title_after_crash); | 108 EXPECT_EQ(title_before_crash, title_after_crash); |
| 99 } | 109 } |
| OLD | NEW |