| 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/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.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents.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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { | 68 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { |
| 69 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); | 69 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); |
| 70 | 70 |
| 71 ui_test_utils::NavigateToURL(browser(), | 71 ui_test_utils::NavigateToURL(browser(), |
| 72 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 72 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 73 FilePath(kTitle2File))); | 73 FilePath(kTitle2File))); |
| 74 | 74 |
| 75 string16 title_before_crash; | 75 string16 title_before_crash; |
| 76 string16 title_after_crash; | 76 string16 title_after_crash; |
| 77 | 77 |
| 78 // Wait for MessageLoop to go idle to make sure title is set. |
| 79 ui_test_utils::RunAllPendingInMessageLoop(); |
| 78 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 80 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 79 &title_before_crash)); | 81 &title_before_crash)); |
| 80 SimulateRendererCrash(browser()); | 82 SimulateRendererCrash(browser()); |
| 81 ui_test_utils::WindowedNotificationObserver observer( | 83 ui_test_utils::WindowedNotificationObserver observer( |
| 82 content::NOTIFICATION_LOAD_STOP, | 84 content::NOTIFICATION_LOAD_STOP, |
| 83 content::Source<NavigationController>( | 85 content::Source<NavigationController>( |
| 84 &browser()->GetActiveWebContents()->GetController())); | 86 &browser()->GetActiveWebContents()->GetController())); |
| 85 browser()->Reload(CURRENT_TAB); | 87 browser()->Reload(CURRENT_TAB); |
| 86 observer.Wait(); | 88 observer.Wait(); |
| 89 |
| 90 // Wait for MessageLoop to go idle to make sure title is set. |
| 91 ui_test_utils::RunAllPendingInMessageLoop(); |
| 87 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), | 92 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
| 88 &title_after_crash)); | 93 &title_after_crash)); |
| 89 EXPECT_EQ(title_before_crash, title_after_crash); | 94 EXPECT_EQ(title_before_crash, title_after_crash); |
| 90 } | 95 } |
| OLD | NEW |