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

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

Issue 1481143002: Added HttpUtils::HasValidators and HttpResponse::HasValidators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« net/http/http_util.cc ('K') | « net/http/http_util.cc ('k') | no next file » | 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) 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
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
OLDNEW
« net/http/http_util.cc ('K') | « net/http/http_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698