Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: chrome/browser/ssl/ssl_host_state_unittest.cc

Issue 2668005: Bring the handling of <keygen> and support for the application/x-x509-user-ce... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Whitespace/style Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/ssl/ssl_host_state.h" 5 #include "chrome/browser/ssl/ssl_host_state.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace { 8 namespace {
9 9
10 // Certificates for test data. They're obtained with: 10 // Certificates for test data. They're obtained with:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 state.HostRanInsecureContent("example.com", 42); 107 state.HostRanInsecureContent("example.com", 42);
108 108
109 EXPECT_TRUE(state.DidHostRunInsecureContent("www.google.com", 42)); 109 EXPECT_TRUE(state.DidHostRunInsecureContent("www.google.com", 42));
110 EXPECT_FALSE(state.DidHostRunInsecureContent("www.google.com", 191)); 110 EXPECT_FALSE(state.DidHostRunInsecureContent("www.google.com", 191));
111 EXPECT_TRUE(state.DidHostRunInsecureContent("example.com", 42)); 111 EXPECT_TRUE(state.DidHostRunInsecureContent("example.com", 42));
112 } 112 }
113 113
114 TEST_F(SSLHostStateTest, QueryPolicy) { 114 TEST_F(SSLHostStateTest, QueryPolicy) {
115 scoped_refptr<net::X509Certificate> google_cert = 115 scoped_refptr<net::X509Certificate> google_cert =
116 net::X509Certificate::CreateFromBytes( 116 net::X509Certificate::CreateFromBytes(
117 reinterpret_cast<const char*>(google_der), sizeof(google_der)); 117 reinterpret_cast<const char*>(google_der), sizeof(google_der),
118 X509Certificate::FORMAT_DER);
118 119
119 SSLHostState state; 120 SSLHostState state;
120 121
121 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"), 122 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"),
122 net::X509Certificate::Policy::UNKNOWN); 123 net::X509Certificate::Policy::UNKNOWN);
123 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"), 124 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"),
124 net::X509Certificate::Policy::UNKNOWN); 125 net::X509Certificate::Policy::UNKNOWN);
125 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"), 126 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"),
126 net::X509Certificate::Policy::UNKNOWN); 127 net::X509Certificate::Policy::UNKNOWN);
127 128
(...skipping 17 matching lines...) Expand all
145 146
146 state.DenyCertForHost(google_cert.get(), "example.com"); 147 state.DenyCertForHost(google_cert.get(), "example.com");
147 148
148 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"), 149 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"),
149 net::X509Certificate::Policy::ALLOWED); 150 net::X509Certificate::Policy::ALLOWED);
150 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"), 151 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"),
151 net::X509Certificate::Policy::UNKNOWN); 152 net::X509Certificate::Policy::UNKNOWN);
152 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"), 153 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"),
153 net::X509Certificate::Policy::DENIED); 154 net::X509Certificate::Policy::DENIED);
154 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/x509_user_cert_resource_handler.cc ('k') | net/base/cert_database_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698