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

Unified Diff: chrome/browser/browser_browsertest.cc

Issue 149559: Make BrowserTest.ThirtyFourTabs not-flaky (Closed)
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/browser_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_browsertest.cc
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index f2098378a90026f5c0fcda42de3132b2ff944098..21750e19453c4c3049d35cd6e18116b3de09d692 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -5,6 +5,7 @@
#include <string>
#include "app/l10n_util.h"
+#include "base/sys_info.h"
#include "chrome/browser/app_modal_dialog.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process.h"
@@ -98,3 +99,26 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) {
EXPECT_EQ(2, browser()->tab_count());
EXPECT_EQ(1, browser()->selected_index());
}
+
+// Create 34 tabs and verify that a lot of processes have been created. The
+// exact number of processes depends on the amount of memory. Previously we
+// had a hard limit of 31 processes and this test is mainly directed at
+// verifying that we don't crash when we pass this limit.
+IN_PROC_BROWSER_TEST_F(BrowserTest, ThirtyFourTabs) {
+ GURL url(ui_test_utils::GetTestUrl(L".", L"title2.html"));
+
+ // There is one initial tab.
+ for (int ix = 0; ix != 33; ++ix) {
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
+ true, 0, false, NULL);
+ }
+ EXPECT_EQ(34, browser()->tab_count());
+
+ // See browser\renderer_host\render_process_host.cc for the algorithm to
+ // decide how many processes to create.
+ if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 2048) {
+ EXPECT_GE(RenderProcessHost::size(), 24U);
+ } else {
+ EXPECT_LE(RenderProcessHost::size(), 23U);
+ }
+}
« no previous file with comments | « no previous file | chrome/browser/browser_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698