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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/basictypes.h" | |
8 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
9 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
11 | 10 |
12 namespace net { | 11 namespace net { |
13 | 12 |
14 namespace { | 13 namespace { |
15 class HttpUtilTest : public testing::Test {}; | 14 class HttpUtilTest : public testing::Test {}; |
16 } | 15 } |
17 | 16 |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 EXPECT_EQ(tests[i].expected_boundary, boundary) << "i=" << i; | 758 EXPECT_EQ(tests[i].expected_boundary, boundary) << "i=" << i; |
760 } | 759 } |
761 } | 760 } |
762 | 761 |
763 TEST(HttpUtilTest, ParseRanges) { | 762 TEST(HttpUtilTest, ParseRanges) { |
764 const struct { | 763 const struct { |
765 const char* const headers; | 764 const char* const headers; |
766 bool expected_return_value; | 765 bool expected_return_value; |
767 size_t expected_ranges_size; | 766 size_t expected_ranges_size; |
768 const struct { | 767 const struct { |
769 int64 expected_first_byte_position; | 768 int64_t expected_first_byte_position; |
770 int64 expected_last_byte_position; | 769 int64_t expected_last_byte_position; |
771 int64 expected_suffix_length; | 770 int64_t expected_suffix_length; |
772 } expected_ranges[10]; | 771 } expected_ranges[10]; |
773 } tests[] = { | 772 } tests[] = { |
774 { "Range: bytes=0-10", | 773 { "Range: bytes=0-10", |
775 true, | 774 true, |
776 1, | 775 1, |
777 { {0, 10, -1}, } | 776 { {0, 10, -1}, } |
778 }, | 777 }, |
779 { "Range: bytes=10-0", | 778 { "Range: bytes=10-0", |
780 false, | 779 false, |
781 0, | 780 0, |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 HttpUtil::NameValuePairsIterator parser(data.begin(), data.end(), ';'); | 1171 HttpUtil::NameValuePairsIterator parser(data.begin(), data.end(), ';'); |
1173 EXPECT_TRUE(parser.valid()); | 1172 EXPECT_TRUE(parser.valid()); |
1174 | 1173 |
1175 ASSERT_NO_FATAL_FAILURE( | 1174 ASSERT_NO_FATAL_FAILURE( |
1176 CheckNextNameValuePair(&parser, true, true, "name", "value")); | 1175 CheckNextNameValuePair(&parser, true, true, "name", "value")); |
1177 ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( | 1176 ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( |
1178 &parser, false, true, std::string(), std::string())); | 1177 &parser, false, true, std::string(), std::string())); |
1179 } | 1178 } |
1180 | 1179 |
1181 } // namespace net | 1180 } // namespace net |
OLD | NEW |