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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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/webui/url_data_manager_backend.cc ('k') | content/common/child_process.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/files/file_path.h" 6 #include "base/files/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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 void RunTest(const std::string& test_case, const std::string& query) { 254 void RunTest(const std::string& test_case, const std::string& query) {
255 RunTest(shell(), test_case, query); 255 RunTest(shell(), test_case, query);
256 } 256 }
257 257
258 static void CountWorkerProcesses(int *cur_process_count) { 258 static void CountWorkerProcesses(int *cur_process_count) {
259 *cur_process_count = 0; 259 *cur_process_count = 0;
260 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) 260 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter)
261 (*cur_process_count)++; 261 (*cur_process_count)++;
262 BrowserThread::PostTask( 262 BrowserThread::PostTask(
263 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure()); 263 BrowserThread::UI, FROM_HERE, base::MessageLoop::QuitClosure());
264 } 264 }
265 265
266 bool WaitForWorkerProcessCount(int count) { 266 bool WaitForWorkerProcessCount(int count) {
267 int cur_process_count; 267 int cur_process_count;
268 for (int i = 0; i < 100; ++i) { 268 for (int i = 0; i < 100; ++i) {
269 BrowserThread::PostTask( 269 BrowserThread::PostTask(
270 BrowserThread::IO, FROM_HERE, 270 BrowserThread::IO, FROM_HERE,
271 base::Bind(&CountWorkerProcesses, &cur_process_count)); 271 base::Bind(&CountWorkerProcesses, &cur_process_count));
272 272
273 RunMessageLoop(); 273 RunMessageLoop();
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // Run test. 481 // Run test.
482 Shell* window = shell(); 482 Shell* window = shell();
483 const string16 expected_title = ASCIIToUTF16("OK"); 483 const string16 expected_title = ASCIIToUTF16("OK");
484 TitleWatcher title_watcher(window->web_contents(), expected_title); 484 TitleWatcher title_watcher(window->web_contents(), expected_title);
485 NavigateToURL(window, url); 485 NavigateToURL(window, url);
486 string16 final_title = title_watcher.WaitAndGetTitle(); 486 string16 final_title = title_watcher.WaitAndGetTitle();
487 EXPECT_EQ(expected_title, final_title); 487 EXPECT_EQ(expected_title, final_title);
488 } 488 }
489 489
490 } // namespace content 490 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/url_data_manager_backend.cc ('k') | content/common/child_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698