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

Side by Side Diff: chrome/browser/browser_uitest.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 | « chrome/browser/browser_browsertest.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/gfx/native_widget_types.h" 6 #include "base/gfx/native_widget_types.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 26 matching lines...) Expand all
37 #endif 37 #endif
38 }; 38 };
39 39
40 class VisibleBrowserTest : public UITest { 40 class VisibleBrowserTest : public UITest {
41 protected: 41 protected:
42 VisibleBrowserTest() : UITest() { 42 VisibleBrowserTest() : UITest() {
43 show_window_ = true; 43 show_window_ = true;
44 } 44 }
45 }; 45 };
46 46
47 // Create 34 tabs and verify that a lot of processes have been created. The
48 // exact number of processes depends on the amount of memory. Previously we
49 // had a hard limit of 31 processes and this test is mainly directed at
50 // verifying that we don't crash when we pass this limit.
51 TEST_F(BrowserTest, ThirtyFourTabs) {
52 FilePath test_file(test_data_directory_);
53 test_file = test_file.AppendASCII("title2.html");
54 GURL url(net::FilePathToFileURL(test_file));
55 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
56 // There is one initial tab.
57 for (int ix = 0; ix != 33; ++ix) {
58 EXPECT_TRUE(window->AppendTab(url));
59 }
60 int tab_count = 0;
61 EXPECT_TRUE(window->GetTabCount(&tab_count));
62 EXPECT_EQ(34, tab_count);
63 // Do not test the rest in single process mode.
64 if (in_process_renderer())
65 return;
66 // See browser\renderer_host\render_process_host.cc for the algorithm to
67 // decide how many processes to create.
68 int process_count = GetBrowserProcessCount();
69 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 2048) {
70 EXPECT_GE(process_count, 24);
71 } else {
72 EXPECT_LE(process_count, 23);
73 }
74 }
75
76 #if defined(OS_WIN) 47 #if defined(OS_WIN)
77 // The browser should quit quickly if it receives a WM_ENDSESSION message. 48 // The browser should quit quickly if it receives a WM_ENDSESSION message.
78 TEST_F(BrowserTest, WindowsSessionEnd) { 49 TEST_F(BrowserTest, WindowsSessionEnd) {
79 FilePath test_file(test_data_directory_); 50 FilePath test_file(test_data_directory_);
80 test_file = test_file.AppendASCII("title1.html"); 51 test_file = test_file.AppendASCII("title1.html");
81 52
82 NavigateToURL(net::FilePathToFileURL(test_file)); 53 NavigateToURL(net::FilePathToFileURL(test_file));
83 PlatformThread::Sleep(action_timeout_ms()); 54 PlatformThread::Sleep(action_timeout_ms());
84 55
85 // Simulate an end of session. Normally this happens when the user 56 // Simulate an end of session. Normally this happens when the user
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 230
260 // Test that window.close() works. Since we don't have a way of executing a 231 // Test that window.close() works. Since we don't have a way of executing a
261 // JS function on the page through TabProxy, reload it and use an unload 232 // JS function on the page through TabProxy, reload it and use an unload
262 // handler that closes the page. 233 // handler that closes the page.
263 ASSERT_EQ(tab->Reload(), AUTOMATION_MSG_NAVIGATION_SUCCESS); 234 ASSERT_EQ(tab->Reload(), AUTOMATION_MSG_NAVIGATION_SUCCESS);
264 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(1, action_timeout_ms())); 235 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(1, action_timeout_ms()));
265 } 236 }
266 #endif 237 #endif
267 238
268 } // namespace 239 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browser_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698