diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_browsertest.cc | 24 | ||||
-rw-r--r-- | chrome/browser/browser_uitest.cc | 29 |
2 files changed, 24 insertions, 29 deletions
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc index f209837..21750e1 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); + } +} diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 57fc6b5..cfec071 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -44,35 +44,6 @@ class VisibleBrowserTest : public UITest { } }; -// 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) { - FilePath test_file(test_data_directory_); - test_file = test_file.AppendASCII("title2.html"); - GURL url(net::FilePathToFileURL(test_file)); - scoped_refptr<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, 23); - } -} - #if defined(OS_WIN) // The browser should quit quickly if it receives a WM_ENDSESSION message. TEST_F(BrowserTest, WindowsSessionEnd) { |