blob: 0919f85437caed9cb2849842ae9b2dd867c47d6d [file] [log] [blame]
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/http/alternative_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace {
TEST(AlternativeServicesTest, IsProtocolEnabledHttp11) {
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoHTTP11,
/*is_http2_enabled=*/false,
/*is_quic_enabled=*/false));
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoHTTP11,
/*is_http2_enabled=*/false,
/*is_quic_enabled=*/true));
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoHTTP11,
/*is_http2_enabled=*/true,
/*is_quic_enabled=*/false));
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoHTTP11,
/*is_http2_enabled=*/true,
/*is_quic_enabled=*/true));
}
TEST(AlternativeServicesTest, IsProtocolEnabledHttp2) {
EXPECT_FALSE(IsProtocolEnabled(NextProto::kProtoHTTP2,
/*is_http2_enabled=*/false,
/*is_quic_enabled=*/false));
EXPECT_FALSE(IsProtocolEnabled(NextProto::kProtoHTTP2,
/*is_http2_enabled=*/false,
/*is_quic_enabled=*/true));
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoHTTP2,
/*is_http2_enabled=*/true,
/*is_quic_enabled=*/false));
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoHTTP2,
/*is_http2_enabled=*/true,
/*is_quic_enabled=*/true));
}
TEST(AlternativeServicesTest, IsProtocolEnabledQuic) {
EXPECT_FALSE(IsProtocolEnabled(NextProto::kProtoQUIC,
/*is_http2_enabled=*/false,
/*is_quic_enabled=*/false));
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoQUIC,
/*is_http2_enabled=*/false,
/*is_quic_enabled=*/true));
EXPECT_FALSE(IsProtocolEnabled(NextProto::kProtoQUIC,
/*is_http2_enabled=*/true,
/*is_quic_enabled=*/false));
EXPECT_TRUE(IsProtocolEnabled(NextProto::kProtoQUIC,
/*is_http2_enabled=*/true,
/*is_quic_enabled=*/true));
}
} // namespace
} // namespace net