OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_commands.h" | 7 #include "chrome/browser/ui/browser_commands.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 }; | 37 }; |
38 | 38 |
39 // Test that reload works after a crash. | 39 // Test that reload works after a crash. |
40 // Disabled, http://crbug.com/29331 , http://crbug.com/69637 . | 40 // Disabled, http://crbug.com/29331 , http://crbug.com/69637 . |
41 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { | 41 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { |
42 // The title of the active tab should change each time this URL is loaded. | 42 // The title of the active tab should change each time this URL is loaded. |
43 GURL url( | 43 GURL url( |
44 "data:text/html,<script>document.title=new Date().valueOf()</script>"); | 44 "data:text/html,<script>document.title=new Date().valueOf()</script>"); |
45 ui_test_utils::NavigateToURL(browser(), url); | 45 ui_test_utils::NavigateToURL(browser(), url); |
46 | 46 |
47 string16 title_before_crash; | 47 base::string16 title_before_crash; |
48 string16 title_after_crash; | 48 base::string16 title_after_crash; |
49 | 49 |
50 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 50 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
51 &title_before_crash)); | 51 &title_before_crash)); |
52 SimulateRendererCrash(browser()); | 52 SimulateRendererCrash(browser()); |
53 content::WindowedNotificationObserver observer( | 53 content::WindowedNotificationObserver observer( |
54 content::NOTIFICATION_LOAD_STOP, | 54 content::NOTIFICATION_LOAD_STOP, |
55 content::Source<NavigationController>( | 55 content::Source<NavigationController>( |
56 &browser()->tab_strip_model()->GetActiveWebContents()-> | 56 &browser()->tab_strip_model()->GetActiveWebContents()-> |
57 GetController())); | 57 GetController())); |
58 chrome::Reload(browser(), CURRENT_TAB); | 58 chrome::Reload(browser(), CURRENT_TAB); |
59 observer.Wait(); | 59 observer.Wait(); |
60 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 60 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
61 &title_after_crash)); | 61 &title_after_crash)); |
62 EXPECT_NE(title_before_crash, title_after_crash); | 62 EXPECT_NE(title_before_crash, title_after_crash); |
63 } | 63 } |
64 | 64 |
65 // Tests that loading a crashed page in a new tab correctly updates the title. | 65 // Tests that loading a crashed page in a new tab correctly updates the title. |
66 // There was an earlier bug (1270510) in process-per-site in which the max page | 66 // There was an earlier bug (1270510) in process-per-site in which the max page |
67 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab | 67 // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab |
68 // was not committed. This prevents regression of that bug. | 68 // was not committed. This prevents regression of that bug. |
69 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { | 69 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { |
70 const base::FilePath::CharType* kTitle2File = | 70 const base::FilePath::CharType* kTitle2File = |
71 FILE_PATH_LITERAL("title2.html"); | 71 FILE_PATH_LITERAL("title2.html"); |
72 | 72 |
73 ui_test_utils::NavigateToURL( | 73 ui_test_utils::NavigateToURL( |
74 browser(), ui_test_utils::GetTestUrl( | 74 browser(), ui_test_utils::GetTestUrl( |
75 base::FilePath(base::FilePath::kCurrentDirectory), | 75 base::FilePath(base::FilePath::kCurrentDirectory), |
76 base::FilePath(kTitle2File))); | 76 base::FilePath(kTitle2File))); |
77 | 77 |
78 string16 title_before_crash; | 78 base::string16 title_before_crash; |
79 string16 title_after_crash; | 79 base::string16 title_after_crash; |
80 | 80 |
81 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 81 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
82 &title_before_crash)); | 82 &title_before_crash)); |
83 SimulateRendererCrash(browser()); | 83 SimulateRendererCrash(browser()); |
84 content::WindowedNotificationObserver observer( | 84 content::WindowedNotificationObserver observer( |
85 content::NOTIFICATION_LOAD_STOP, | 85 content::NOTIFICATION_LOAD_STOP, |
86 content::Source<NavigationController>( | 86 content::Source<NavigationController>( |
87 &browser()->tab_strip_model()->GetActiveWebContents()-> | 87 &browser()->tab_strip_model()->GetActiveWebContents()-> |
88 GetController())); | 88 GetController())); |
89 chrome::Reload(browser(), CURRENT_TAB); | 89 chrome::Reload(browser(), CURRENT_TAB); |
90 observer.Wait(); | 90 observer.Wait(); |
91 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 91 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
92 &title_after_crash)); | 92 &title_after_crash)); |
93 EXPECT_EQ(title_before_crash, title_after_crash); | 93 EXPECT_EQ(title_before_crash, title_after_crash); |
94 } | 94 } |
OLD | NEW |