Add signalSyncPoint to the WebGraphicsContext3D command buffer impls.
[chromium-blink-merge.git] / net / cert / x509_util_unittest.cc
blobee42f1c46e0e81496bcda5fad120f6c911e2c335
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
3 // found in the LICENSE file.
5 #include "net/cert/x509_util.h"
7 #include <algorithm>
9 #include "base/time.h"
10 #include "net/cert/x509_certificate.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace net {
15 namespace x509_util {
17 TEST(X509UtilTest, SortClientCertificates) {
18 CertificateList certs;
20 const base::Time now = base::Time::Now();
21 const base::TimeDelta five_days = base::TimeDelta::FromDays(5);
23 certs.push_back(scoped_refptr<X509Certificate>(NULL));
24 certs.push_back(new X509Certificate(
25 "expired", "expired",
26 base::Time::UnixEpoch(), base::Time::UnixEpoch()));
27 certs.push_back(new X509Certificate(
28 "not yet valid", "not yet valid",
29 base::Time::Max(), base::Time::Max()));
30 certs.push_back(new X509Certificate(
31 "older cert", "older cert",
32 now - five_days, now + five_days));
33 certs.push_back(scoped_refptr<X509Certificate>(NULL));
34 certs.push_back(new X509Certificate(
35 "newer cert", "newer cert",
36 now - base::TimeDelta::FromDays(3), now + five_days));
38 std::sort(certs.begin(), certs.end(), ClientCertSorter());
40 ASSERT_TRUE(certs[0].get());
41 EXPECT_EQ("newer cert", certs[0]->subject().common_name);
42 ASSERT_TRUE(certs[1].get());
43 EXPECT_EQ("older cert", certs[1]->subject().common_name);
44 ASSERT_TRUE(certs[2].get());
45 EXPECT_EQ("not yet valid", certs[2]->subject().common_name);
46 ASSERT_TRUE(certs[3].get());
47 EXPECT_EQ("expired", certs[3]->subject().common_name);
48 ASSERT_FALSE(certs[4].get());
49 ASSERT_FALSE(certs[5].get());
52 } // namespace x509_util
54 } // namespace net