| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |