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