Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/browser/crash_recovery_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser_commands.h" 7 #include "chrome/browser/ui/browser_commands.h"
8 #include "chrome/browser/ui/browser_tabstrip.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents.h"
9 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
10 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/page_transition_types.h" 16 #include "content/public/common/page_transition_types.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
(...skipping 28 matching lines...) Expand all
46 47
47 string16 title_before_crash; 48 string16 title_before_crash;
48 string16 title_after_crash; 49 string16 title_after_crash;
49 50
50 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), 51 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
51 &title_before_crash)); 52 &title_before_crash));
52 SimulateRendererCrash(browser()); 53 SimulateRendererCrash(browser());
53 ui_test_utils::WindowedNotificationObserver observer( 54 ui_test_utils::WindowedNotificationObserver observer(
54 content::NOTIFICATION_LOAD_STOP, 55 content::NOTIFICATION_LOAD_STOP,
55 content::Source<NavigationController>( 56 content::Source<NavigationController>(
56 &browser()->GetActiveWebContents()->GetController())); 57 &chrome::GetActiveWebContents(browser())->GetController()));
57 chrome::Reload(browser(), CURRENT_TAB); 58 chrome::Reload(browser(), CURRENT_TAB);
58 observer.Wait(); 59 observer.Wait();
59 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), 60 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
60 &title_after_crash)); 61 &title_after_crash));
61 EXPECT_NE(title_before_crash, title_after_crash); 62 EXPECT_NE(title_before_crash, title_after_crash);
62 } 63 }
63 64
64 // 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.
65 // 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
66 // 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
67 // was not committed. This prevents regression of that bug. 68 // was not committed. This prevents regression of that bug.
68 // http://crbug.com/57158 - Times out sometimes on all platforms. 69 // http://crbug.com/57158 - Times out sometimes on all platforms.
69 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { 70 IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) {
70 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); 71 const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html");
71 72
72 ui_test_utils::NavigateToURL(browser(), 73 ui_test_utils::NavigateToURL(browser(),
73 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), 74 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
74 FilePath(kTitle2File))); 75 FilePath(kTitle2File)));
75 76
76 string16 title_before_crash; 77 string16 title_before_crash;
77 string16 title_after_crash; 78 string16 title_after_crash;
78 79
79 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), 80 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
80 &title_before_crash)); 81 &title_before_crash));
81 SimulateRendererCrash(browser()); 82 SimulateRendererCrash(browser());
82 ui_test_utils::WindowedNotificationObserver observer( 83 ui_test_utils::WindowedNotificationObserver observer(
83 content::NOTIFICATION_LOAD_STOP, 84 content::NOTIFICATION_LOAD_STOP,
84 content::Source<NavigationController>( 85 content::Source<NavigationController>(
85 &browser()->GetActiveWebContents()->GetController())); 86 &chrome::GetActiveWebContents(browser())->GetController()));
86 chrome::Reload(browser(), CURRENT_TAB); 87 chrome::Reload(browser(), CURRENT_TAB);
87 observer.Wait(); 88 observer.Wait();
88 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), 89 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
89 &title_after_crash)); 90 &title_after_crash));
90 EXPECT_EQ(title_before_crash, title_after_crash); 91 EXPECT_EQ(title_before_crash, title_after_crash);
91 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698