Chromium Code Reviews| 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" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "net/http/http_util.h" | 9 #include "net/http/http_util.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1171 std::string data = "name='value"; | 1171 std::string data = "name='value"; |
| 1172 HttpUtil::NameValuePairsIterator parser(data.begin(), data.end(), ';'); | 1172 HttpUtil::NameValuePairsIterator parser(data.begin(), data.end(), ';'); |
| 1173 EXPECT_TRUE(parser.valid()); | 1173 EXPECT_TRUE(parser.valid()); |
| 1174 | 1174 |
| 1175 ASSERT_NO_FATAL_FAILURE( | 1175 ASSERT_NO_FATAL_FAILURE( |
| 1176 CheckNextNameValuePair(&parser, true, true, "name", "value")); | 1176 CheckNextNameValuePair(&parser, true, true, "name", "value")); |
| 1177 ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( | 1177 ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( |
| 1178 &parser, false, true, std::string(), std::string())); | 1178 &parser, false, true, std::string(), std::string())); |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 TEST(HttpUtilTest, HasValidators) { | |
|
bengr
2015/12/03 17:42:21
For completeness, I think you should test the foll
jamartin (wrong)
2015/12/08 16:58:18
Done.
I've gone for the full N^3 approach on this
| |
| 1182 EXPECT_FALSE(HttpUtil::HasValidators(HttpVersion(0, 9), "anything", | |
| 1183 "Tue, 15 Nov 1994 12:45:26 GMT")); | |
| 1184 | |
| 1185 EXPECT_FALSE(HttpUtil::HasValidators(HttpVersion(1, 0), "", "")); | |
| 1186 EXPECT_FALSE(HttpUtil::HasValidators(HttpVersion(1, 0), "stub etag", "")); | |
|
bengr
2015/12/03 17:42:21
Maybe use the string "anything" here too, as well
jamartin (wrong)
2015/12/08 16:58:18
Done.
| |
| 1187 EXPECT_FALSE(HttpUtil::HasValidators(HttpVersion(1, 0), "", "invalid date")); | |
| 1188 EXPECT_TRUE(HttpUtil::HasValidators(HttpVersion(1, 0), "", | |
|
bengr
2015/12/03 17:42:21
Also EXPECT_TRUE when both an etag and a last-modi
jamartin (wrong)
2015/12/08 16:58:18
Done.
| |
| 1189 "Tue, 15 Nov 1994 12:45:26 GMT")); | |
| 1190 | |
| 1191 EXPECT_FALSE(HttpUtil::HasValidators(HttpVersion(1, 1), "", "")); | |
| 1192 EXPECT_TRUE(HttpUtil::HasValidators(HttpVersion(1, 1), "stub etag", "")); | |
| 1193 EXPECT_TRUE(HttpUtil::HasValidators(HttpVersion(1, 1), "stub etag", | |
| 1194 "Tue, 15 Nov 1994 12:45:26 GMT")); | |
| 1195 } | |
| 1196 | |
| 1181 } // namespace net | 1197 } // namespace net |
| OLD | NEW |