1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file. 4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "net/ssl/ssl_connection_status_flags.h" 6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h" 8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace net { 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace { 12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)TEST(SSLConnectionStatusTest, SetCipherSuite) { 14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int connection_status = 0xDEADBEEF; 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int expected_version = SSLConnectionStatusToVersion(connection_status); 16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) SSLConnectionStatusSetCipherSuite(12345, &connection_status); 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EXPECT_EQ(12345, SSLConnectionStatusToCipherSuite(connection_status)); 19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EXPECT_EQ(expected_version, SSLConnectionStatusToVersion(connection_status)); 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} 21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)TEST(SSLConnectionStatusTest, SetVersion) { 23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int connection_status = 0xDEADBEEF; 24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int expected_cipher_suite = 25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) SSLConnectionStatusToCipherSuite(connection_status); 26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) SSLConnectionStatusSetVersion(SSL_CONNECTION_VERSION_TLS1_2, 28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) &connection_status); 29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EXPECT_EQ(SSL_CONNECTION_VERSION_TLS1_2, 30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) SSLConnectionStatusToVersion(connection_status)); 31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EXPECT_EQ(expected_cipher_suite, 32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) SSLConnectionStatusToCipherSuite(connection_status)); 33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} 34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} // namespace 36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} // namespace net 38