| 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/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 output_value_ = input_value_; | 50 output_value_ = input_value_; |
| 51 | 51 |
| 52 { // This lock might be destroyed after work_called_ is signalled. | 52 { // This lock might be destroyed after work_called_ is signalled. |
| 53 base::AutoLock lock(work_lock_); | 53 base::AutoLock lock(work_lock_); |
| 54 work_running_ = false; | 54 work_running_ = false; |
| 55 } | 55 } |
| 56 work_called_.Signal(); | 56 work_called_.Signal(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void OnWorkFinished() { | 59 void OnWorkFinished() { |
| 60 EXPECT_TRUE(message_loop_ == base::MessageLoop::current()); | 60 EXPECT_TRUE(message_loop_->task_runner()->BelongsToCurrentThread()); |
| 61 EXPECT_EQ(output_value_, input_value_); | 61 EXPECT_EQ(output_value_, input_value_); |
| 62 BreakNow("OnWorkFinished"); | 62 BreakNow("OnWorkFinished"); |
| 63 } | 63 } |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 void BreakCallback(const std::string& breakpoint) { | 66 void BreakCallback(const std::string& breakpoint) { |
| 67 breakpoint_ = breakpoint; | 67 breakpoint_ = breakpoint; |
| 68 base::MessageLoop::current()->QuitNow(); | 68 base::MessageLoop::current()->QuitNow(); |
| 69 } | 69 } |
| 70 | 70 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 RunUntilBreak("OnWorkFinished"); | 157 RunUntilBreak("OnWorkFinished"); |
| 158 | 158 |
| 159 // No more tasks should remain. | 159 // No more tasks should remain. |
| 160 EXPECT_TRUE(message_loop_->IsIdleForTesting()); | 160 EXPECT_TRUE(message_loop_->IsIdleForTesting()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace | 163 } // namespace |
| 164 | 164 |
| 165 } // namespace net | 165 } // namespace net |
| 166 | 166 |
| OLD | NEW |