| 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/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 std::string allowed = "\t"; | 1385 std::string allowed = "\t"; |
| 1386 for (char c = '\x20'; c < '\x7F'; ++c) { | 1386 for (char c = '\x20'; c < '\x7F'; ++c) { |
| 1387 allowed.append(1, c); | 1387 allowed.append(1, c); |
| 1388 } | 1388 } |
| 1389 for (int c = 0x80; c <= 0xFF; ++c) { | 1389 for (int c = 0x80; c <= 0xFF; ++c) { |
| 1390 allowed.append(1, static_cast<char>(c)); | 1390 allowed.append(1, static_cast<char>(c)); |
| 1391 } | 1391 } |
| 1392 EXPECT_TRUE(HttpUtil::IsValidHeaderValue(allowed)); | 1392 EXPECT_TRUE(HttpUtil::IsValidHeaderValue(allowed)); |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 TEST(HttpUtilTest, IsToken) { |
| 1396 EXPECT_TRUE(HttpUtil::IsToken("valid")); |
| 1397 EXPECT_FALSE(HttpUtil::IsToken("")); |
| 1398 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece())); |
| 1399 EXPECT_FALSE(HttpUtil::IsToken("hello, world")); |
| 1400 } |
| 1401 |
| 1395 } // namespace net | 1402 } // namespace net |
| OLD | NEW |