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

Side by Side Diff: net/http/http_byte_range_unittest.cc

Issue 78343004: Net: Standardize HttpByteRange printing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_byte_range.cc ('k') | net/http/partial_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/http/http_byte_range.h" 5 #include "net/http/http_byte_range.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 TEST(HttpByteRangeTest, ValidRanges) { 8 TEST(HttpByteRangeTest, ValidRanges) {
9 const struct { 9 const struct {
10 int64 first_byte_position; 10 int64 first_byte_position;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Try to call SetInstanceSize the second time. 70 // Try to call SetInstanceSize the second time.
71 EXPECT_FALSE(range.ComputeBounds(tests[i].instance_size)); 71 EXPECT_FALSE(range.ComputeBounds(tests[i].instance_size));
72 // And expect there's no side effect. 72 // And expect there's no side effect.
73 EXPECT_EQ(tests[i].expected_lower_bound, range.first_byte_position()); 73 EXPECT_EQ(tests[i].expected_lower_bound, range.first_byte_position());
74 EXPECT_EQ(tests[i].expected_upper_bound, range.last_byte_position()); 74 EXPECT_EQ(tests[i].expected_upper_bound, range.last_byte_position());
75 EXPECT_EQ(tests[i].suffix_length, range.suffix_length()); 75 EXPECT_EQ(tests[i].suffix_length, range.suffix_length());
76 } 76 }
77 } 77 }
78 } 78 }
79
80 TEST(HttpByteRangeTest, GetHeaderValue) {
81 static const struct {
82 net::HttpByteRange range;
83 const char* expected;
84 } tests[] = {{net::HttpByteRange::Bounded(0, 0), "bytes=0-0"},
85 {net::HttpByteRange::Bounded(0, 100), "bytes=0-100"},
86 {net::HttpByteRange::Bounded(0, -1), "bytes=0-"},
87 {net::HttpByteRange::RightUnbounded(100), "bytes=100-"},
88 {net::HttpByteRange::Suffix(100), "bytes=-100"}, };
89 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
90 EXPECT_EQ(tests[i].expected, tests[i].range.GetHeaderValue());
91 }
92 }
OLDNEW
« no previous file with comments | « net/http/http_byte_range.cc ('k') | net/http/partial_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698