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

Side by Side Diff: chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/chrome_url_request_context.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/net/chrome_fraudulent_certificate_reporter.h" 5 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 const net::SSLInfo& ssl_info, 144 const net::SSLInfo& ssl_info,
145 bool sni_available) { 145 bool sni_available) {
146 DCHECK(!hostname.empty()); 146 DCHECK(!hostname.empty());
147 DCHECK(ssl_info.is_valid()); 147 DCHECK(ssl_info.is_valid());
148 ChromeFraudulentCertificateReporter::SendReport(hostname, ssl_info, 148 ChromeFraudulentCertificateReporter::SendReport(hostname, ssl_info,
149 sni_available); 149 sni_available);
150 } 150 }
151 }; 151 };
152 152
153 static void DoReportIsSent() { 153 static void DoReportIsSent() {
154 scoped_refptr<ChromeURLRequestContext> context = new ChromeURLRequestContext; 154 ChromeURLRequestContext context;
155 SendingTestReporter reporter(context.get()); 155 SendingTestReporter reporter(&context);
156 SSLInfo info = GetGoodSSLInfo(); 156 SSLInfo info = GetGoodSSLInfo();
157 reporter.SendReport("mail.google.com", info, true); 157 reporter.SendReport("mail.google.com", info, true);
158 } 158 }
159 159
160 static void DoReportIsNotSent() { 160 static void DoReportIsNotSent() {
161 scoped_refptr<ChromeURLRequestContext> context = new ChromeURLRequestContext; 161 ChromeURLRequestContext context;
162 NotSendingTestReporter reporter(context.get()); 162 NotSendingTestReporter reporter(&context);
163 SSLInfo info = GetBadSSLInfo(); 163 SSLInfo info = GetBadSSLInfo();
164 reporter.SendReport("www.example.com", info, true); 164 reporter.SendReport("www.example.com", info, true);
165 } 165 }
166 166
167 static void DoMockReportIsSent() { 167 static void DoMockReportIsSent() {
168 scoped_refptr<ChromeURLRequestContext> context = new ChromeURLRequestContext; 168 ChromeURLRequestContext context;
169 MockReporter reporter(context.get()); 169 MockReporter reporter(&context);
170 SSLInfo info = GetGoodSSLInfo(); 170 SSLInfo info = GetGoodSSLInfo();
171 reporter.SendReport("mail.google.com", info, true); 171 reporter.SendReport("mail.google.com", info, true);
172 } 172 }
173 173
174 TEST(ChromeFraudulentCertificateReporterTest, GoodBadInfo) { 174 TEST(ChromeFraudulentCertificateReporterTest, GoodBadInfo) {
175 SSLInfo good = GetGoodSSLInfo(); 175 SSLInfo good = GetGoodSSLInfo();
176 EXPECT_TRUE(IsGoodSSLInfo(good)); 176 EXPECT_TRUE(IsGoodSSLInfo(good));
177 177
178 SSLInfo bad = GetBadSSLInfo(); 178 SSLInfo bad = GetBadSSLInfo();
179 EXPECT_FALSE(IsGoodSSLInfo(bad)); 179 EXPECT_FALSE(IsGoodSSLInfo(bad));
(...skipping 14 matching lines...) Expand all
194 } 194 }
195 195
196 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) { 196 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) {
197 MessageLoop loop(MessageLoop::TYPE_IO); 197 MessageLoop loop(MessageLoop::TYPE_IO);
198 content::TestBrowserThread io_thread(BrowserThread::IO, &loop); 198 content::TestBrowserThread io_thread(BrowserThread::IO, &loop);
199 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent)); 199 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent));
200 loop.RunAllPending(); 200 loop.RunAllPending();
201 } 201 }
202 202
203 } // namespace chrome_browser_net 203 } // namespace chrome_browser_net
204
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/chrome_url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698