| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_util.h" | 5 #include "base/file_util.h" |
| 6 #include "chrome/common/url_constants.h" | |
| 7 #include "chrome/test/automation/browser_proxy.h" | 6 #include "chrome/test/automation/browser_proxy.h" |
| 8 #include "chrome/test/automation/tab_proxy.h" | 7 #include "chrome/test/automation/tab_proxy.h" |
| 9 #include "chrome/test/ui/ui_test.h" | 8 #include "chrome/test/ui/ui_test.h" |
| 10 #include "net/base/net_util.h" | 9 #include "net/base/net_util.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 typedef UITest CrashRecoveryUITest; | 12 typedef UITest CrashRecoveryUITest; |
| 14 | 13 |
| 15 TEST_F(CrashRecoveryUITest, Reload) { | 14 TEST_F(CrashRecoveryUITest, Reload) { |
| 16 // Test that reload works after a crash. | 15 // Test that reload works after a crash. |
| 17 | 16 |
| 18 // This test only works in multi-process mode | 17 // This test only works in multi-process mode |
| 19 if (in_process_renderer()) | 18 if (in_process_renderer()) |
| 20 return; | 19 return; |
| 21 | 20 |
| 22 // The title of the active tab should change each time this URL is loaded. | 21 // The title of the active tab should change each time this URL is loaded. |
| 23 GURL url( | 22 GURL url( |
| 24 "data:text/html,<script>document.title=new Date().valueOf()</script>"); | 23 "data:text/html,<script>document.title=new Date().valueOf()</script>"); |
| 25 | 24 |
| 26 NavigateToURL(url); | 25 NavigateToURL(url); |
| 27 | 26 |
| 28 std::wstring title1 = GetActiveTabTitle(); | 27 std::wstring title1 = GetActiveTabTitle(); |
| 29 | 28 |
| 30 scoped_ptr<TabProxy> tab(GetActiveTab()); | 29 scoped_ptr<TabProxy> tab(GetActiveTab()); |
| 31 | 30 |
| 32 // Cause the renderer to crash. | 31 // Cause the renderer to crash. |
| 33 expected_crashes_ = 1; | 32 expected_crashes_ = 1; |
| 34 tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)); | 33 tab->NavigateToURLAsync(GURL("about:crash")); |
| 35 | 34 |
| 36 Sleep(1000); // Wait for the browser to notice the renderer crash. | 35 Sleep(1000); // Wait for the browser to notice the renderer crash. |
| 37 | 36 |
| 38 tab->Reload(); | 37 tab->Reload(); |
| 39 | 38 |
| 40 std::wstring title2 = GetActiveTabTitle(); | 39 std::wstring title2 = GetActiveTabTitle(); |
| 41 EXPECT_NE(title1, title2); | 40 EXPECT_NE(title1, title2); |
| 42 } | 41 } |
| 43 | 42 |
| 44 // Tests that loading a crashed page in a new tab correctly updates the title. | 43 // Tests that loading a crashed page in a new tab correctly updates the title. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 | 56 |
| 58 NavigateToURL(url); | 57 NavigateToURL(url); |
| 59 | 58 |
| 60 const std::wstring title(L"Title Of Awesomeness"); | 59 const std::wstring title(L"Title Of Awesomeness"); |
| 61 EXPECT_EQ(title, GetActiveTabTitle()); | 60 EXPECT_EQ(title, GetActiveTabTitle()); |
| 62 | 61 |
| 63 scoped_ptr<TabProxy> tab(GetActiveTab()); | 62 scoped_ptr<TabProxy> tab(GetActiveTab()); |
| 64 | 63 |
| 65 // Cause the renderer to crash. | 64 // Cause the renderer to crash. |
| 66 expected_crashes_ = 1; | 65 expected_crashes_ = 1; |
| 67 tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)); | 66 tab->NavigateToURLAsync(GURL("about:crash")); |
| 68 | 67 |
| 69 Sleep(1000); // Wait for the browser to notice the renderer crash. | 68 Sleep(1000); // Wait for the browser to notice the renderer crash. |
| 70 | 69 |
| 71 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 70 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 72 ASSERT_TRUE(browser_proxy->AppendTab(url)); | 71 ASSERT_TRUE(browser_proxy->AppendTab(url)); |
| 73 | 72 |
| 74 // Ensure the title of the new tab is updated, indicating that the navigation | 73 // Ensure the title of the new tab is updated, indicating that the navigation |
| 75 // entry was properly committed. | 74 // entry was properly committed. |
| 76 EXPECT_EQ(title, GetActiveTabTitle()); | 75 EXPECT_EQ(title, GetActiveTabTitle()); |
| 77 } | 76 } |
| 78 | 77 |
| OLD | NEW |