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

Side by Side Diff: chrome/test/memory_test/memory_test.cc

Issue 63113: Convert Windows Sleep to PlatformThread::Sleep... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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-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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/browser/net/url_fixer_upper.h" 11 #include "chrome/browser/net/url_fixer_upper.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 size_t start_size = GetSystemCommitCharge(); 213 size_t start_size = GetSystemCommitCharge();
214 214
215 // Cycle through the URLs. 215 // Cycle through the URLs.
216 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); 216 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
217 scoped_ptr<TabProxy> tab(window->GetActiveTab()); 217 scoped_ptr<TabProxy> tab(window->GetActiveTab());
218 int expected_tab_count = 1; 218 int expected_tab_count = 1;
219 for (unsigned counter = 0; counter < arraysize(urls); ++counter) { 219 for (unsigned counter = 0; counter < arraysize(urls); ++counter) {
220 std::string url = urls[counter]; 220 std::string url = urls[counter];
221 221
222 if (url == "<PAUSE>") { // Special command to delay on this page 222 if (url == "<PAUSE>") { // Special command to delay on this page
223 Sleep(2000); 223 PlatformThread::Sleep(2000);
224 continue; 224 continue;
225 } 225 }
226 226
227 if (url == "<NEWTAB>") { // Special command to create a new tab 227 if (url == "<NEWTAB>") { // Special command to create a new tab
228 if (++counter >= arraysize(urls)) 228 if (++counter >= arraysize(urls))
229 continue; // Newtab was specified at end of list. ignore. 229 continue; // Newtab was specified at end of list. ignore.
230 230
231 url = urls[counter]; 231 url = urls[counter];
232 if (GetTabCount() < num_target_tabs) { 232 if (GetTabCount() < num_target_tabs) {
233 EXPECT_TRUE(window->AppendTab(GURL(url))); 233 EXPECT_TRUE(window->AppendTab(GURL(url)));
(...skipping 10 matching lines...) Expand all
244 const int kMaxWaitTime = 5000; 244 const int kMaxWaitTime = 5000;
245 bool timed_out = false; 245 bool timed_out = false;
246 tab->NavigateToURLWithTimeout(GURL(urls[counter]), kMaxWaitTime, 246 tab->NavigateToURLWithTimeout(GURL(urls[counter]), kMaxWaitTime,
247 &timed_out); 247 &timed_out);
248 if (timed_out) 248 if (timed_out)
249 printf("warning: %s timed out!\n", urls[counter].c_str()); 249 printf("warning: %s timed out!\n", urls[counter].c_str());
250 250
251 // TODO(mbelshe): Bug 2953 251 // TODO(mbelshe): Bug 2953
252 // The automation crashes periodically if we cycle too quickly. 252 // The automation crashes periodically if we cycle too quickly.
253 // To make these tests more reliable, slowing them down a bit. 253 // To make these tests more reliable, slowing them down a bit.
254 Sleep(100); 254 PlatformThread::Sleep(100);
255 } 255 }
256 size_t stop_size = GetSystemCommitCharge(); 256 size_t stop_size = GetSystemCommitCharge();
257 257
258 PrintResults(test_name, stop_size - start_size); 258 PrintResults(test_name, stop_size - start_size);
259 } 259 }
260 260
261 void PrintResults(const char* test_name, size_t commit_size) { 261 void PrintResults(const char* test_name, size_t commit_size) {
262 PrintMemoryUsageInfo(test_name); 262 PrintMemoryUsageInfo(test_name);
263 std::string trace_name(test_name); 263 std::string trace_name(test_name);
264 trace_name.append("_cc"); 264 trace_name.append("_cc");
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 RunTest("1t", 1); 429 RunTest("1t", 1);
430 } 430 }
431 431
432 TEST_F(MemoryTest, FiveTabTest) { 432 TEST_F(MemoryTest, FiveTabTest) {
433 RunTest("5t", 5); 433 RunTest("5t", 5);
434 } 434 }
435 435
436 TEST_F(MemoryTest, TwelveTabTest) { 436 TEST_F(MemoryTest, TwelveTabTest) {
437 RunTest("12t", 12); 437 RunTest("12t", 12);
438 } 438 }
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_proxy_uitest.cc ('k') | chrome/test/reliability/page_load_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698