Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: net/base/prioritized_dispatcher_unittest.cc

Issue 1866483002: Add a new priority level, THROTTLED, below IDLE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjusted predictor priorities. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "net/base/prioritized_dispatcher.h" 5 #include "net/base/prioritized_dispatcher.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "net/base/request_priority.h" 14 #include "net/base/request_priority.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 namespace { 19 namespace {
20 20
21 // We rely on the priority enum values being sequential having starting at 0, 21 // We rely on the priority enum values being sequential having starting at 0,
22 // and increasing for higher priorities. 22 // and increasing for higher priorities.
23 static_assert(MINIMUM_PRIORITY == 0u && MINIMUM_PRIORITY == IDLE && 23 static_assert(MINIMUM_PRIORITY == 0u && MINIMUM_PRIORITY == THROTTLED &&
24 IDLE < LOWEST && LOWEST < HIGHEST && 24 THROTTLED < IDLE &&
25 IDLE < LOWEST &&
26 LOWEST < HIGHEST &&
25 HIGHEST <= MAXIMUM_PRIORITY, 27 HIGHEST <= MAXIMUM_PRIORITY,
26 "priority indexes incompatible"); 28 "priority indexes incompatible");
27 29
28 class PrioritizedDispatcherTest : public testing::Test { 30 class PrioritizedDispatcherTest : public testing::Test {
29 public: 31 public:
30 typedef PrioritizedDispatcher::Priority Priority; 32 typedef PrioritizedDispatcher::Priority Priority;
31 // A job that appends |tag| to |log| when started and '.' when finished. 33 // A job that appends |tag| to |log| when started and '.' when finished.
32 // This is intended to confirm the execution order of a sequence of jobs added 34 // This is intended to confirm the execution order of a sequence of jobs added
33 // to the dispatcher. Note that finishing order of jobs does not matter. 35 // to the dispatcher. Note that finishing order of jobs does not matter.
34 class TestJob : public PrioritizedDispatcher::Job { 36 class TestJob : public PrioritizedDispatcher::Job {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 PrioritizedDispatcher::Handle handle = job_b->handle(); 543 PrioritizedDispatcher::Handle handle = job_b->handle();
542 ASSERT_FALSE(handle.is_null()); 544 ASSERT_FALSE(handle.is_null());
543 dispatcher_->Cancel(handle); 545 dispatcher_->Cancel(handle);
544 EXPECT_DEBUG_DEATH(dispatcher_->Cancel(handle), ""); 546 EXPECT_DEBUG_DEATH(dispatcher_->Cancel(handle), "");
545 } 547 }
546 #endif // GTEST_HAS_DEATH_TEST && !defined(NDEBUG) 548 #endif // GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
547 549
548 } // namespace 550 } // namespace
549 551
550 } // namespace net 552 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698