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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "net/base/prioritized_dispatcher.h" | 11 #include "net/base/prioritized_dispatcher.h" |
12 #include "net/base/request_priority.h" | 12 #include "net/base/request_priority.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // We rely on the priority enum values being sequential having starting at 0, | 19 // We rely on the priority enum values being sequential having starting at 0, |
20 // and increasing for lower priorities. | 20 // and increasing for higher priorities. |
21 COMPILE_ASSERT(HIGHEST == 0u && | 21 COMPILE_ASSERT(MINIMUM_PRIORITY == 0u && |
Ryan Hamilton
2012/04/23 22:51:05
Please also assert that IDLE == 0 (or == MINIMUM_P
mmenke
2012/04/24 14:30:18
nit: Suggest you switch the order of the above tw
| |
22 LOWEST > HIGHEST && | 22 LOWEST < HIGHEST && |
23 IDLE > LOWEST && | 23 IDLE < LOWEST && |
24 NUM_PRIORITIES > IDLE, | 24 NUM_PRIORITIES > IDLE, |
25 priority_indexes_incompatible); | 25 priority_indexes_incompatible); |
26 | 26 |
27 class PrioritizedDispatcherTest : public testing::Test { | 27 class PrioritizedDispatcherTest : public testing::Test { |
28 public: | 28 public: |
29 typedef PrioritizedDispatcher::Priority Priority; | 29 typedef PrioritizedDispatcher::Priority Priority; |
30 // A job that appends |data| to |log_| when started and '.' when finished. | 30 // A job that appends |data| to |log_| when started and '.' when finished. |
31 // This is intended to confirm the execution order of a sequence of jobs added | 31 // This is intended to confirm the execution order of a sequence of jobs added |
32 // to the dispatcher. | 32 // to the dispatcher. |
33 class TestJob : public PrioritizedDispatcher::Job { | 33 class TestJob : public PrioritizedDispatcher::Job { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 job_c->Finish(); | 270 job_c->Finish(); |
271 job_e->Finish(); | 271 job_e->Finish(); |
272 | 272 |
273 Expect("a.c.e."); | 273 Expect("a.c.e."); |
274 } | 274 } |
275 | 275 |
276 } // namespace | 276 } // namespace |
277 | 277 |
278 } // namespace net | 278 } // namespace net |
279 | 279 |
OLD | NEW |