| OLD | NEW |
| 1 // Copyright (c) 2010 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/tab_contents/navigation_entry.h" | 6 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/common/notification_type.h" | 8 #include "chrome/common/notification_type.h" |
| 9 #include "chrome/common/page_transition_types.h" | 9 #include "chrome/common/page_transition_types.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "chrome/test/in_process_browser_test.h" | 11 #include "chrome/test/in_process_browser_test.h" |
| 12 #include "chrome/test/ui_test_utils.h" | 12 #include "chrome/test/ui_test_utils.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void SimulateRendererCrash(Browser* browser) { | 17 void SimulateRendererCrash(Browser* browser) { |
| 18 browser->OpenURL(GURL(chrome::kAboutCrashURL), GURL(), CURRENT_TAB, | 18 browser->OpenURL(GURL(chrome::kAboutCrashURL), GURL(), CURRENT_TAB, |
| 19 PageTransition::TYPED); | 19 PageTransition::TYPED); |
| 20 ui_test_utils::WaitForNotification( | 20 ui_test_utils::WaitForNotification( |
| 21 NotificationType::TAB_CONTENTS_DISCONNECTED); | 21 NotificationType::TAB_CONTENTS_DISCONNECTED); |
| 22 } | 22 } |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 class CrashRecoveryBrowserTest : public InProcessBrowserTest { | 26 class CrashRecoveryBrowserTest : public InProcessBrowserTest { |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // http://crbug.com/29331 - Causes an OS crash dialog in release mode, needs to | |
| 30 // be fixed before it can be enabled to not cause the bots issues. | |
| 31 #if defined(OS_MACOSX) | |
| 32 #define MAYBE_Reload DISABLED_Reload | |
| 33 #else | |
| 34 #define MAYBE_Reload Reload | |
| 35 #endif | |
| 36 | |
| 37 // Test that reload works after a crash. | 29 // Test that reload works after a crash. |
| 38 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, MAYBE_Reload) { | 30 // Disabled, http://crbug.com/29331, http://crbug.com/69637. |
| 31 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, DISABLED_Reload) { |
| 39 // The title of the active tab should change each time this URL is loaded. | 32 // The title of the active tab should change each time this URL is loaded. |
| 40 GURL url( | 33 GURL url( |
| 41 "data:text/html,<script>document.title=new Date().valueOf()</script>"); | 34 "data:text/html,<script>document.title=new Date().valueOf()</script>"); |
| 42 ui_test_utils::NavigateToURL(browser(), url); | 35 ui_test_utils::NavigateToURL(browser(), url); |
| 43 | 36 |
| 44 string16 title_before_crash; | 37 string16 title_before_crash; |
| 45 string16 title_after_crash; | 38 string16 title_after_crash; |
| 46 | 39 |
| 47 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 40 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 48 &title_before_crash)); | 41 &title_before_crash)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 | 64 |
| 72 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 65 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 73 &title_before_crash)); | 66 &title_before_crash)); |
| 74 SimulateRendererCrash(browser()); | 67 SimulateRendererCrash(browser()); |
| 75 browser()->Reload(CURRENT_TAB); | 68 browser()->Reload(CURRENT_TAB); |
| 76 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 69 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 77 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 70 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 78 &title_after_crash)); | 71 &title_after_crash)); |
| 79 EXPECT_EQ(title_before_crash, title_after_crash); | 72 EXPECT_EQ(title_before_crash, title_after_crash); |
| 80 } | 73 } |
| OLD | NEW |