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 && |
22 LOWEST > HIGHEST && | 22 MINIMUM_PRIORITY == IDLE && |
23 IDLE > LOWEST && | 23 IDLE < LOWEST && |
24 NUM_PRIORITIES > IDLE, | 24 LOWEST < HIGHEST && |
| 25 HIGHEST < NUM_PRIORITIES, |
25 priority_indexes_incompatible); | 26 priority_indexes_incompatible); |
26 | 27 |
27 class PrioritizedDispatcherTest : public testing::Test { | 28 class PrioritizedDispatcherTest : public testing::Test { |
28 public: | 29 public: |
29 typedef PrioritizedDispatcher::Priority Priority; | 30 typedef PrioritizedDispatcher::Priority Priority; |
30 // A job that appends |data| to |log_| when started and '.' when finished. | 31 // 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 | 32 // This is intended to confirm the execution order of a sequence of jobs added |
32 // to the dispatcher. | 33 // to the dispatcher. |
33 class TestJob : public PrioritizedDispatcher::Job { | 34 class TestJob : public PrioritizedDispatcher::Job { |
34 public: | 35 public: |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 job_c->Finish(); | 271 job_c->Finish(); |
271 job_e->Finish(); | 272 job_e->Finish(); |
272 | 273 |
273 Expect("a.c.e."); | 274 Expect("a.c.e."); |
274 } | 275 } |
275 | 276 |
276 } // namespace | 277 } // namespace |
277 | 278 |
278 } // namespace net | 279 } // namespace net |
279 | 280 |
OLD | NEW |