| OLD | NEW |
| 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 <ctype.h> | 5 #include <ctype.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return job; | 146 return job; |
| 147 } | 147 } |
| 148 | 148 |
| 149 TestJob* AddJobAtHead(char data, Priority priority) { | 149 TestJob* AddJobAtHead(char data, Priority priority) { |
| 150 TestJob* job = new TestJob(dispatcher_.get(), data, priority, &log_); | 150 TestJob* job = new TestJob(dispatcher_.get(), data, priority, &log_); |
| 151 jobs_.push_back(job); | 151 jobs_.push_back(job); |
| 152 job->Add(true); | 152 job->Add(true); |
| 153 return job; | 153 return job; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void Expect(std::string log) { | 156 void Expect(const std::string& log) { |
| 157 EXPECT_EQ(0u, dispatcher_->num_queued_jobs()); | 157 EXPECT_EQ(0u, dispatcher_->num_queued_jobs()); |
| 158 EXPECT_EQ(0u, dispatcher_->num_running_jobs()); | 158 EXPECT_EQ(0u, dispatcher_->num_running_jobs()); |
| 159 EXPECT_EQ(log, log_); | 159 EXPECT_EQ(log, log_); |
| 160 log_.clear(); | 160 log_.clear(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 std::string log_; | 163 std::string log_; |
| 164 scoped_ptr<PrioritizedDispatcher> dispatcher_; | 164 scoped_ptr<PrioritizedDispatcher> dispatcher_; |
| 165 ScopedVector<TestJob> jobs_; | 165 ScopedVector<TestJob> jobs_; |
| 166 }; | 166 }; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 PrioritizedDispatcher::Handle handle = job_b->handle(); | 541 PrioritizedDispatcher::Handle handle = job_b->handle(); |
| 542 ASSERT_FALSE(handle.is_null()); | 542 ASSERT_FALSE(handle.is_null()); |
| 543 dispatcher_->Cancel(handle); | 543 dispatcher_->Cancel(handle); |
| 544 EXPECT_DEBUG_DEATH(dispatcher_->Cancel(handle), ""); | 544 EXPECT_DEBUG_DEATH(dispatcher_->Cancel(handle), ""); |
| 545 } | 545 } |
| 546 #endif // GTEST_HAS_DEATH_TEST && !defined(NDEBUG) | 546 #endif // GTEST_HAS_DEATH_TEST && !defined(NDEBUG) |
| 547 | 547 |
| 548 } // namespace | 548 } // namespace |
| 549 | 549 |
| 550 } // namespace net | 550 } // namespace net |
| OLD | NEW |