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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/browser_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/sys_info.h"
8 #include "chrome/browser/app_modal_dialog.h" 9 #include "chrome/browser/app_modal_dialog.h"
9 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/tab_contents/tab_contents.h" 12 #include "chrome/browser/tab_contents/tab_contents.h"
12 #include "chrome/common/page_transition_types.h" 13 #include "chrome/common/page_transition_types.h"
13 #include "chrome/test/in_process_browser_test.h" 14 #include "chrome/test/in_process_browser_test.h"
14 #include "chrome/test/ui_test_utils.h" 15 #include "chrome/test/ui_test_utils.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "grit/chromium_strings.h" 17 #include "grit/chromium_strings.h"
17 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 EXPECT_EQ(0, browser()->selected_index()); 92 EXPECT_EQ(0, browser()->selected_index());
92 TabContents* second_tab = browser()->GetTabContentsAt(1); 93 TabContents* second_tab = browser()->GetTabContentsAt(1);
93 ASSERT_TRUE(second_tab); 94 ASSERT_TRUE(second_tab);
94 second_tab->render_view_host()->ExecuteJavascriptInWebFrame(L"", 95 second_tab->render_view_host()->ExecuteJavascriptInWebFrame(L"",
95 L"alert('Activate!');"); 96 L"alert('Activate!');");
96 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 97 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
97 alert->CloseModalDialog(); 98 alert->CloseModalDialog();
98 EXPECT_EQ(2, browser()->tab_count()); 99 EXPECT_EQ(2, browser()->tab_count());
99 EXPECT_EQ(1, browser()->selected_index()); 100 EXPECT_EQ(1, browser()->selected_index());
100 } 101 }
102
103 // Create 34 tabs and verify that a lot of processes have been created. The
104 // exact number of processes depends on the amount of memory. Previously we
105 // had a hard limit of 31 processes and this test is mainly directed at
106 // verifying that we don't crash when we pass this limit.
107 IN_PROC_BROWSER_TEST_F(BrowserTest, ThirtyFourTabs) {
108 GURL url(ui_test_utils::GetTestUrl(L".", L"title2.html"));
109
110 // There is one initial tab.
111 for (int ix = 0; ix != 33; ++ix) {
112 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
113 true, 0, false, NULL);
114 }
115 EXPECT_EQ(34, browser()->tab_count());
116
117 // See browser\renderer_host\render_process_host.cc for the algorithm to
118 // decide how many processes to create.
119 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 2048) {
120 EXPECT_GE(RenderProcessHost::size(), 24U);
121 } else {
122 EXPECT_LE(RenderProcessHost::size(), 23U);
123 }
124 }
OLDNEW
« 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