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

Side by Side Diff: content/browser/worker_host/test/worker_browsertest.cc

Issue 10822030: Move ui_test_utils::RunMessageLoop to test_utils so that it can be reused by content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/plugin_service_impl_browsertest.cc ('k') | content/public/test/test_utils.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 5 #include "base/bind.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure()); 307 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure());
308 } 308 }
309 309
310 bool WaitForWorkerProcessCount(int count) { 310 bool WaitForWorkerProcessCount(int count) {
311 int cur_process_count; 311 int cur_process_count;
312 for (int i = 0; i < 100; ++i) { 312 for (int i = 0; i < 100; ++i) {
313 BrowserThread::PostTask( 313 BrowserThread::PostTask(
314 BrowserThread::IO, FROM_HERE, 314 BrowserThread::IO, FROM_HERE,
315 base::Bind(&CountWorkerProcesses, &cur_process_count)); 315 base::Bind(&CountWorkerProcesses, &cur_process_count));
316 316
317 base::RunLoop run_loop; 317 content::RunMessageLoop();
318 content::RunThisRunLoop(&run_loop);
319 if (cur_process_count == count) 318 if (cur_process_count == count)
320 return true; 319 return true;
321 320
322 // Sometimes the worker processes can take a while to shut down on the 321 // Sometimes the worker processes can take a while to shut down on the
323 // bots, so use a longer timeout period to avoid spurious failures. 322 // bots, so use a longer timeout period to avoid spurious failures.
324 base::PlatformThread::Sleep(TestTimeouts::action_max_timeout() / 100); 323 base::PlatformThread::Sleep(TestTimeouts::action_max_timeout() / 100);
325 } 324 }
326 325
327 EXPECT_EQ(cur_process_count, count); 326 EXPECT_EQ(cur_process_count, count);
328 return false; 327 return false;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 495
497 // First window has hit its limit. Now launch second window which creates 496 // First window has hit its limit. Now launch second window which creates
498 // the same worker that was queued in the first window, to ensure it gets 497 // the same worker that was queued in the first window, to ensure it gets
499 // connected to the first window too. 498 // connected to the first window too.
500 query = StringPrintf("?id=%d", max_workers_per_tab); 499 query = StringPrintf("?id=%d", max_workers_per_tab);
501 url = GetTestURL("single_shared_worker.html", query); 500 url = GetTestURL("single_shared_worker.html", query);
502 content::NavigateToURL(CreateBrowser(), url); 501 content::NavigateToURL(CreateBrowser(), url);
503 502
504 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1)); 503 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1));
505 } 504 }
OLDNEW
« no previous file with comments | « content/browser/plugin_service_impl_browsertest.cc ('k') | content/public/test/test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698