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

Side by Side Diff: extensions/test/result_catcher.cc

Issue 2564943002: Reland "Add thread checking to RunLoop, deprecate MessageLoopRunner. (patchset #4 id:20002 of https… (Closed)
Patch Set: Created 4 years 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 | « content/public/test/test_utils.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/test/result_catcher.h" 5 #include "extensions/test/result_catcher.h"
6 6
7 #include "content/public/browser/notification_service.h" 7 #include "content/public/browser/notification_service.h"
8 #include "content/public/test/test_utils.h" 8 #include "content/public/test/test_utils.h"
9 #include "extensions/browser/notification_types.h" 9 #include "extensions/browser/notification_types.h"
10 10
(...skipping 12 matching lines...) Expand all
23 ResultCatcher::~ResultCatcher() { 23 ResultCatcher::~ResultCatcher() {
24 } 24 }
25 25
26 bool ResultCatcher::GetNextResult() { 26 bool ResultCatcher::GetNextResult() {
27 // Depending on the tests, multiple results can come in from a single call 27 // Depending on the tests, multiple results can come in from a single call
28 // to RunMessageLoop(), so we maintain a queue of results and just pull them 28 // to RunMessageLoop(), so we maintain a queue of results and just pull them
29 // off as the test calls this, going to the run loop only when the queue is 29 // off as the test calls this, going to the run loop only when the queue is
30 // empty. 30 // empty.
31 if (results_.empty()) { 31 if (results_.empty()) {
32 base::RunLoop run_loop; 32 base::RunLoop run_loop;
33 quit_closure_ = content::GetQuitTaskForRunLoop(&run_loop); 33 quit_closure_ = content::GetDeferredQuitTaskForRunLoop(&run_loop);
34 content::RunThisRunLoop(&run_loop); 34 content::RunThisRunLoop(&run_loop);
35 quit_closure_ = base::Closure(); 35 quit_closure_ = base::Closure();
36 } 36 }
37 37
38 if (!results_.empty()) { 38 if (!results_.empty()) {
39 bool ret = results_.front(); 39 bool ret = results_.front();
40 results_.pop_front(); 40 results_.pop_front();
41 message_ = messages_.front(); 41 message_ = messages_.front();
42 messages_.pop_front(); 42 messages_.pop_front();
43 return ret; 43 return ret;
(...skipping 30 matching lines...) Expand all
74 quit_closure_.Run(); 74 quit_closure_.Run();
75 } 75 }
76 break; 76 break;
77 77
78 default: 78 default:
79 NOTREACHED(); 79 NOTREACHED();
80 } 80 }
81 } 81 }
82 82
83 } // namespace extensions 83 } // namespace extensions
OLDNEW
« no previous file with comments | « content/public/test/test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698