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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 2 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/command_line.h" 5 #include "base/command_line.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/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 22 matching lines...) Expand all
33 // Ensure that we get there by checking for non-empty page content. 33 // Ensure that we get there by checking for non-empty page content.
34 ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); 34 ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:"));
35 bool empty_inner_html = false; 35 bool empty_inner_html = false;
36 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 36 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
37 browser()->tab_strip_model()->GetWebContentsAt(0), 37 browser()->tab_strip_model()->GetWebContentsAt(0),
38 "window.domAutomationController.send(document.body.innerHTML == '')", 38 "window.domAutomationController.send(document.body.innerHTML == '')",
39 &empty_inner_html)); 39 &empty_inner_html));
40 ASSERT_FALSE(empty_inner_html); 40 ASSERT_FALSE(empty_inner_html);
41 } 41 }
42 42
43 #if defined(OS_WIN)
44 // Flaky on Windows (http://crbug.com/174819)
45 #define MAYBE_LoadNTPInExistingProcess DISABLED_LoadNTPInExistingProcess
46 #else
47 #define MAYBE_LoadNTPInExistingProcess LoadNTPInExistingProcess
48 #endif
49
50 // Ensure loading a NTP with an existing SiteInstance in a reused process 43 // Ensure loading a NTP with an existing SiteInstance in a reused process
51 // doesn't cause us to kill the process. See http://crbug.com/104258. 44 // doesn't cause us to kill the process. See http://crbug.com/104258.
52 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, MAYBE_LoadNTPInExistingProcess) { 45 // TODO(samarth): remove along with NTP4 code.
46 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, DISABLED_LoadNTPInExistingProcess) {
53 // Set max renderers to 1 to force running out of processes. 47 // Set max renderers to 1 to force running out of processes.
54 content::RenderProcessHost::SetMaxRendererProcessCount(1); 48 content::RenderProcessHost::SetMaxRendererProcessCount(1);
55 49
56 // Start server for simple page. 50 // Start server for simple page.
57 ASSERT_TRUE(test_server()->Start()); 51 ASSERT_TRUE(test_server()->Start());
58 52
59 // Load a NTP in a new tab. 53 // Load a NTP in a new tab.
60 ui_test_utils::NavigateToURLWithDisposition( 54 ui_test_utils::NavigateToURLWithDisposition(
61 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 55 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB,
62 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 56 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // swap, so it gets a new SiteInstance starting with page ID 1 again. 99 // swap, so it gets a new SiteInstance starting with page ID 1 again.
106 browser()->tab_strip_model()->ActivateTabAt(1, true); 100 browser()->tab_strip_model()->ActivateTabAt(1, true);
107 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 101 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
108 EXPECT_EQ(1, 102 EXPECT_EQ(1,
109 browser()->tab_strip_model()->GetWebContentsAt(1)->GetMaxPageID()); 103 browser()->tab_strip_model()->GetWebContentsAt(1)->GetMaxPageID());
110 } 104 }
111 105
112 // Loads chrome://hang/ into two NTP tabs, ensuring we don't crash. 106 // Loads chrome://hang/ into two NTP tabs, ensuring we don't crash.
113 // See http://crbug.com/59859. 107 // See http://crbug.com/59859.
114 // If this flakes, use http://crbug.com/87200. 108 // If this flakes, use http://crbug.com/87200.
115 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeHangInNTP) { 109 // TODO(samarth): remove along with NTP4 code.
110 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, DISABLED_ChromeHangInNTP) {
116 // Bring up a new tab page. 111 // Bring up a new tab page.
117 ui_test_utils::NavigateToURLWithDisposition( 112 ui_test_utils::NavigateToURLWithDisposition(
118 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 113 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB,
119 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 114 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
120 115
121 // Navigate to chrome://hang/ to stall the process. 116 // Navigate to chrome://hang/ to stall the process.
122 ui_test_utils::NavigateToURLWithDisposition( 117 ui_test_utils::NavigateToURLWithDisposition(
123 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); 118 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0);
124 119
125 // Visit chrome://hang/ again in another NTP. Don't bother waiting for the 120 // Visit chrome://hang/ again in another NTP. Don't bother waiting for the
(...skipping 10 matching lines...) Expand all
136 131
137 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 132 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
138 command_line->AppendSwitch(switches::kProcessPerTab); 133 command_line->AppendSwitch(switches::kProcessPerTab);
139 } 134 }
140 }; 135 };
141 136
142 // Navigates away from NTP before it commits, in process-per-tab mode. 137 // Navigates away from NTP before it commits, in process-per-tab mode.
143 // Ensures that we don't load the normal page in the NTP process (and thus 138 // Ensures that we don't load the normal page in the NTP process (and thus
144 // crash), as in http://crbug.com/69224. 139 // crash), as in http://crbug.com/69224.
145 // If this flakes, use http://crbug.com/87200 140 // If this flakes, use http://crbug.com/87200
146 IN_PROC_BROWSER_TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) { 141 // TODO(samarth): remove along with NTP4 code.
142 IN_PROC_BROWSER_TEST_F(NewTabUIProcessPerTabTest,
143 DISABLED_NavBeforeNTPCommits) {
147 // Bring up a new tab page. 144 // Bring up a new tab page.
148 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 145 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
149 146
150 // Navigate to chrome://hang/ to stall the process. 147 // Navigate to chrome://hang/ to stall the process.
151 ui_test_utils::NavigateToURLWithDisposition( 148 ui_test_utils::NavigateToURLWithDisposition(
152 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); 149 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0);
153 150
154 // Visit a normal URL in another NTP that hasn't committed. 151 // Visit a normal URL in another NTP that hasn't committed.
155 ui_test_utils::NavigateToURLWithDisposition( 152 ui_test_utils::NavigateToURLWithDisposition(
156 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0); 153 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0);
157 154
158 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits 155 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits
159 // for current loading to stop. 156 // for current loading to stop.
160 content::TestNavigationObserver observer( 157 content::TestNavigationObserver observer(
161 browser()->tab_strip_model()->GetActiveWebContents()); 158 browser()->tab_strip_model()->GetActiveWebContents());
162 browser()->OpenURL(OpenURLParams( 159 browser()->OpenURL(OpenURLParams(
163 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, 160 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB,
164 content::PAGE_TRANSITION_TYPED, false)); 161 content::PAGE_TRANSITION_TYPED, false));
165 observer.Wait(); 162 observer.Wait();
166 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698