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

Unified Diff: chrome/browser/browser_uitest.cc

Issue 21484: Update the table of RAM vs number of renderers... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
Index: chrome/browser/browser_uitest.cc
===================================================================
--- chrome/browser/browser_uitest.cc (revision 9891)
+++ chrome/browser/browser_uitest.cc (working copy)
@@ -4,6 +4,7 @@
#include "base/file_util.h"
#include "base/string_util.h"
+#include "base/sys_info.h"
#include "base/values.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/common/chrome_constants.h"
@@ -85,6 +86,35 @@
EXPECT_EQ(test_title, GetActiveTabTitle());
}
+// 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.
+TEST_F(BrowserTest, ThirtyFourTabs) {
+ std::wstring test_file = test_data_directory_;
+ file_util::AppendToPath(&test_file, L"title2.html");
+ GURL url(net::FilePathToFileURL(test_file));
+ scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ // There is one initial tab.
+ for (int ix = 0; ix != 33; ++ix) {
+ EXPECT_TRUE(window->AppendTab(url));
+ }
+ int tab_count = 0;
+ EXPECT_TRUE(window->GetTabCount(&tab_count));
+ EXPECT_EQ(34, tab_count);
+ // Do not test the rest in single process mode.
+ if (in_process_renderer())
+ return;
M-A Ruel 2009/02/19 12:33:56 nit: Why not EXPECT_EQ(process_count, 0); ?
+ // See browser\renderer_host\render_process_host.cc for the algorithm to
+ // decide how many processes to create.
+ int process_count = GetBrowserProcessCount();
+ if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 2048) {
+ EXPECT_GE(process_count, 24);
+ } else {
+ EXPECT_LE(process_count, 22);
+ }
+}
+
// The browser should quit quickly if it receives a WM_ENDSESSION message.
TEST_F(BrowserTest, WindowsSessionEnd) {
std::wstring test_file = test_data_directory_;

Powered by Google App Engine
This is Rietveld 408576698