| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { | 69 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { |
| 70 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); | 70 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); |
| 71 | 71 |
| 72 ui_test_utils::NavigateToURL(browser(), | 72 ui_test_utils::NavigateToURL(browser(), |
| 73 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 73 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 74 FilePath(kTitle2File))); | 74 FilePath(kTitle2File))); |
| 75 | 75 |
| 76 string16 title_before_crash; | 76 string16 title_before_crash; |
| 77 string16 title_after_crash; | 77 string16 title_after_crash; |
| 78 | 78 |
| 79 // Wait for MessageLoop to go idle to make sure title is set. |
| 80 ui_test_utils::RunAllPendingInMessageLoop(); |
| 79 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 81 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 80 &title_before_crash)); | 82 &title_before_crash)); |
| 81 SimulateRendererCrash(browser()); | 83 SimulateRendererCrash(browser()); |
| 82 ui_test_utils::WindowedNotificationObserver observer( | 84 ui_test_utils::WindowedNotificationObserver observer( |
| 83 content::NOTIFICATION_LOAD_STOP, | 85 content::NOTIFICATION_LOAD_STOP, |
| 84 content::Source<NavigationController>( | 86 content::Source<NavigationController>( |
| 85 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 87 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
| 86 GetController())); | 88 GetController())); |
| 87 browser()->Reload(CURRENT_TAB); | 89 browser()->Reload(CURRENT_TAB); |
| 88 observer.Wait(); | 90 observer.Wait(); |
| 91 |
| 92 // Wait for MessageLoop to go idle to make sure title is set. |
| 93 ui_test_utils::RunAllPendingInMessageLoop(); |
| 89 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 94 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 90 &title_after_crash)); | 95 &title_after_crash)); |
| 91 EXPECT_EQ(title_before_crash, title_after_crash); | 96 EXPECT_EQ(title_before_crash, title_after_crash); |
| 92 } | 97 } |
| OLD | NEW |