summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_uitest.cc
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 18:47:41 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 18:47:41 +0000
commit06768c2f67ae0353981851c6f6af29df85747b75 (patch)
tree3edc51f88c03fe463d5d49d7ba75d2e9d1b956e8 /chrome/browser/browser_uitest.cc
parent2e39d2ebf7e388595bd7fe17d99e30e8a35a43fc (diff)
downloadchromium_src-06768c2f67ae0353981851c6f6af29df85747b75.zip
chromium_src-06768c2f67ae0353981851c6f6af29df85747b75.tar.gz
chromium_src-06768c2f67ae0353981851c6f6af29df85747b75.tar.bz2
Update the table of RAM vs number of renderers
- revised my guesstimate of 25 MB per renderer to 40MB, which I think is more appropiate for long lived tabs, since short lived tabs don't really matter here. - the lower end (< 1GB) has less total renderers - the middle has about the same - the upper end (> 2GB) has more renderers - added test to open 34 tabs. Review URL: http://codereview.chromium.org/21484 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_uitest.cc')
-rw-r--r--chrome/browser/browser_uitest.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index 5096923..efaaa45 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -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 @@ TEST_F(BrowserTest, Title) {
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;
+ // 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_;