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

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

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 EXPECT_FALSE(state.DidHostRunInsecureContent("example.com", 42)); 105 EXPECT_FALSE(state.DidHostRunInsecureContent("example.com", 42));
106 106
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 118
119 SSLHostState state; 119 SSLHostState state;
120 120
121 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"), 121 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"),
122 net::CertPolicy::UNKNOWN); 122 net::CertPolicy::UNKNOWN);
123 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"), 123 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"),
124 net::CertPolicy::UNKNOWN); 124 net::CertPolicy::UNKNOWN);
125 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"), 125 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"),
126 net::CertPolicy::UNKNOWN); 126 net::CertPolicy::UNKNOWN);
127 127
(...skipping 17 matching lines...) Expand all
145 145
146 state.DenyCertForHost(google_cert.get(), "example.com"); 146 state.DenyCertForHost(google_cert.get(), "example.com");
147 147
148 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"), 148 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"),
149 net::CertPolicy::ALLOWED); 149 net::CertPolicy::ALLOWED);
150 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"), 150 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"),
151 net::CertPolicy::UNKNOWN); 151 net::CertPolicy::UNKNOWN);
152 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"), 152 EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"),
153 net::CertPolicy::DENIED); 153 net::CertPolicy::DENIED);
154 } 154 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698