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

Side by Side Diff: chrome/browser/browser_uitest.cc

Issue 21484: Update the table of RAM vs number of renderers... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | Annotate | Revision Log
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_util.h" 5 #include "base/file_util.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/sys_info.h"
7 #include "base/values.h" 8 #include "base/values.h"
8 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/common/chrome_constants.h" 10 #include "chrome/common/chrome_constants.h"
10 #include "chrome/common/l10n_util.h" 11 #include "chrome/common/l10n_util.h"
11 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
12 #include "chrome/test/automation/browser_proxy.h" 13 #include "chrome/test/automation/browser_proxy.h"
13 #include "chrome/test/automation/tab_proxy.h" 14 #include "chrome/test/automation/tab_proxy.h"
14 #include "chrome/test/automation/window_proxy.h" 15 #include "chrome/test/automation/window_proxy.h"
15 #include "chrome/test/ui/ui_test.h" 16 #include "chrome/test/ui/ui_test.h"
16 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 file_util::AppendToPath(&test_file, L"title2.html"); 79 file_util::AppendToPath(&test_file, L"title2.html");
79 80
80 NavigateToURL(net::FilePathToFileURL(test_file)); 81 NavigateToURL(net::FilePathToFileURL(test_file));
81 Sleep(sleep_timeout_ms()); // The browser lazily updates the title. 82 Sleep(sleep_timeout_ms()); // The browser lazily updates the title.
82 83
83 const std::wstring test_title(L"Title Of Awesomeness"); 84 const std::wstring test_title(L"Title Of Awesomeness");
84 EXPECT_EQ(WindowCaptionFromPageTitle(test_title), GetWindowTitle()); 85 EXPECT_EQ(WindowCaptionFromPageTitle(test_title), GetWindowTitle());
85 EXPECT_EQ(test_title, GetActiveTabTitle()); 86 EXPECT_EQ(test_title, GetActiveTabTitle());
86 } 87 }
87 88
89 // Create 34 tabs and verify that a lot of processes have been created. The
90 // exact number of processes depends on the amount of memory. Previously we
91 // had a hard limit of 31 processes and this test is mainly directed at
92 // verifying that we don't crash when we pass this limit.
93 TEST_F(BrowserTest, ThirtyFourTabs) {
94 std::wstring test_file = test_data_directory_;
95 file_util::AppendToPath(&test_file, L"title2.html");
96 GURL url(net::FilePathToFileURL(test_file));
97 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
98 // There is one initial tab.
99 for (int ix = 0; ix != 33; ++ix) {
100 EXPECT_TRUE(window->AppendTab(url));
101 }
102 int tab_count = 0;
103 EXPECT_TRUE(window->GetTabCount(&tab_count));
104 EXPECT_EQ(34, tab_count);
105 // Do not test the rest in single process mode.
106 if (in_process_renderer())
107 return;
M-A Ruel 2009/02/19 12:33:56 nit: Why not EXPECT_EQ(process_count, 0); ?
108 // See browser\renderer_host\render_process_host.cc for the algorithm to
109 // decide how many processes to create.
110 int process_count = GetBrowserProcessCount();
111 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 2048) {
112 EXPECT_GE(process_count, 24);
113 } else {
114 EXPECT_LE(process_count, 22);
115 }
116 }
117
88 // The browser should quit quickly if it receives a WM_ENDSESSION message. 118 // The browser should quit quickly if it receives a WM_ENDSESSION message.
89 TEST_F(BrowserTest, WindowsSessionEnd) { 119 TEST_F(BrowserTest, WindowsSessionEnd) {
90 std::wstring test_file = test_data_directory_; 120 std::wstring test_file = test_data_directory_;
91 file_util::AppendToPath(&test_file, L"title1.html"); 121 file_util::AppendToPath(&test_file, L"title1.html");
92 122
93 NavigateToURL(net::FilePathToFileURL(test_file)); 123 NavigateToURL(net::FilePathToFileURL(test_file));
94 Sleep(action_timeout_ms()); 124 Sleep(action_timeout_ms());
95 125
96 // Simulate an end of session. Normally this happens when the user 126 // Simulate an end of session. Normally this happens when the user
97 // shuts down the pc or logs off. 127 // shuts down the pc or logs off.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (title == L"PASSED") { 276 if (title == L"PASSED") {
247 // Success, bail out. 277 // Success, bail out.
248 break; 278 break;
249 } 279 }
250 } 280 }
251 281
252 if (i == 10) 282 if (i == 10)
253 FAIL() << "failed to get error page title"; 283 FAIL() << "failed to get error page title";
254 } 284 }
255 285
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698