summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 21:10:49 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 21:10:49 +0000
commitec28f8e18f1ae9593b07a055aa05fd2920fcb044 (patch)
treef620c691ac68480f98277f1229675719e4b8adee
parentfea93f3d409d1467b794955d156e130e984c2704 (diff)
downloadchromium_src-ec28f8e18f1ae9593b07a055aa05fd2920fcb044.zip
chromium_src-ec28f8e18f1ae9593b07a055aa05fd2920fcb044.tar.gz
chromium_src-ec28f8e18f1ae9593b07a055aa05fd2920fcb044.tar.bz2
Make BrowserTest.ThirtyFourTabs not-flaky
I converted it to browser_tests framework, so I can just query RenderProcessHost instead of counting "chrome" processes, which apparently induced the flakiness. TEST=Covered by browser_tests. http://crbug.com/16062 Review URL: http://codereview.chromium.org/149559 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20661 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_browsertest.cc24
-rw-r--r--chrome/browser/browser_uitest.cc29
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) {