prune resources in MemoryCache
[chromium-blink-merge.git] / net / spdy / spdy_http_utils_unittest.cc
blobb66534be0c2dcc4f6998706d27d59447accd22cb
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
3 // found in the LICENSE file.
5 #include "net/spdy/spdy_http_utils.h"
7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace net {
12 namespace {
14 TEST(SpdyHttpUtilsTest, ConvertRequestPriorityToSpdy3Priority) {
15 EXPECT_EQ(0, ConvertRequestPriorityToSpdyPriority(HIGHEST, SPDY3));
16 EXPECT_EQ(1, ConvertRequestPriorityToSpdyPriority(MEDIUM, SPDY3));
17 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOW, SPDY3));
18 EXPECT_EQ(3, ConvertRequestPriorityToSpdyPriority(LOWEST, SPDY3));
19 EXPECT_EQ(4, ConvertRequestPriorityToSpdyPriority(IDLE, SPDY3));
22 TEST(SpdyHttpUtilsTest, ConvertSpdy3PriorityToRequestPriority) {
23 EXPECT_EQ(HIGHEST, ConvertSpdyPriorityToRequestPriority(0, SPDY3));
24 EXPECT_EQ(MEDIUM, ConvertSpdyPriorityToRequestPriority(1, SPDY3));
25 EXPECT_EQ(LOW, ConvertSpdyPriorityToRequestPriority(2, SPDY3));
26 EXPECT_EQ(LOWEST, ConvertSpdyPriorityToRequestPriority(3, SPDY3));
27 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(4, SPDY3));
28 // These are invalid values, but we should still handle them
29 // gracefully.
30 for (int i = 5; i < kuint8max; ++i) {
31 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(i, SPDY3));
35 } // namespace
37 } // namespace net