| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/dns/serial_worker.h" | 5 #include "net/dns/serial_worker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 output_value_ = input_value_; | 51 output_value_ = input_value_; |
| 52 | 52 |
| 53 { // This lock might be destroyed after work_called_ is signalled. | 53 { // This lock might be destroyed after work_called_ is signalled. |
| 54 base::AutoLock lock(work_lock_); | 54 base::AutoLock lock(work_lock_); |
| 55 work_running_ = false; | 55 work_running_ = false; |
| 56 } | 56 } |
| 57 work_called_.Signal(); | 57 work_called_.Signal(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void OnWorkFinished() { | 60 void OnWorkFinished() { |
| 61 EXPECT_TRUE(message_loop_ == base::MessageLoop::current()); | 61 EXPECT_TRUE(message_loop_->task_runner()->BelongsToCurrentThread()); |
| 62 EXPECT_EQ(output_value_, input_value_); | 62 EXPECT_EQ(output_value_, input_value_); |
| 63 BreakNow("OnWorkFinished"); | 63 BreakNow("OnWorkFinished"); |
| 64 } | 64 } |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 void BreakCallback(const std::string& breakpoint) { | 67 void BreakCallback(const std::string& breakpoint) { |
| 68 breakpoint_ = breakpoint; | 68 breakpoint_ = breakpoint; |
| 69 base::MessageLoop::current()->QuitNow(); | 69 base::MessageLoop::current()->QuitNow(); |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 RunUntilBreak("OnWorkFinished"); | 158 RunUntilBreak("OnWorkFinished"); |
| 159 | 159 |
| 160 // No more tasks should remain. | 160 // No more tasks should remain. |
| 161 EXPECT_TRUE(message_loop_->IsIdleForTesting()); | 161 EXPECT_TRUE(message_loop_->IsIdleForTesting()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace | 164 } // namespace |
| 165 | 165 |
| 166 } // namespace net | 166 } // namespace net |
| 167 | 167 |
| OLD | NEW |