This source file includes following definitions.
- TEST
- TEST
#include "net/quic/crypto/crypto_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace test {
namespace {
TEST(CryptoUtilsTest, IsValidSNI) {
EXPECT_FALSE(CryptoUtils::IsValidSNI("192.168.0.1"));
EXPECT_FALSE(CryptoUtils::IsValidSNI("somedomain"));
EXPECT_FALSE(CryptoUtils::IsValidSNI(""));
EXPECT_TRUE(CryptoUtils::IsValidSNI("test.google.com"));
}
TEST(CryptoUtilsTest, NormalizeHostname) {
struct {
const char *input, *expected;
} tests[] = {
{ "www.google.com", "www.google.com", },
{ "WWW.GOOGLE.COM", "www.google.com", },
{ "www.google.com.", "www.google.com", },
{ "www.google.COM.", "www.google.com", },
{ "www.google.com..", "www.google.com", },
{ "www.google.com........", "www.google.com", },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
EXPECT_EQ(std::string(tests[i].expected),
CryptoUtils::NormalizeHostname(tests[i].input));
}
}
}
}
}