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

Side by Side Diff: net/http/disk_based_cert_cache_unittest.cc

Issue 1230113012: [net] Better StopCaching() handling for HttpCache::Transaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing MockTransaction initializers Created 5 years, 3 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
« no previous file with comments | « no previous file | net/http/http_cache.h » ('j') | net/http/http_cache_transaction.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "net/http/disk_based_cert_cache.h" 5 #include "net/http/disk_based_cert_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 26 matching lines...) Expand all
37 37
38 // MockTransactions are required to use the MockDiskCache backend. 38 // MockTransactions are required to use the MockDiskCache backend.
39 // |key| is a cache key, and is equivalent to the key that will be 39 // |key| is a cache key, and is equivalent to the key that will be
40 // used to store or retrieve certificates in the cache. |test_mode| 40 // used to store or retrieve certificates in the cache. |test_mode|
41 // is an integer that is used to indicate properties of the test 41 // is an integer that is used to indicate properties of the test
42 // transaction, mostly whether or not it is synchronous. 42 // transaction, mostly whether or not it is synchronous.
43 // For testing the DiskBasedCertCache, other data members of the struct 43 // For testing the DiskBasedCertCache, other data members of the struct
44 // are irrelevant. Only one MockTransaction per certificate can be used 44 // are irrelevant. Only one MockTransaction per certificate can be used
45 // at a time. 45 // at a time.
46 MockTransaction CreateMockTransaction(const char* key, int test_mode) { 46 MockTransaction CreateMockTransaction(const char* key, int test_mode) {
47 MockTransaction transaction = {key, "", base::Time(), "", LOAD_NORMAL, 47 MockTransaction transaction = {
48 "", "", base::Time(), "", test_mode, 48 key, "", base::Time(), "", LOAD_NORMAL, "", "",
49 NULL, 0, OK}; 49 base::Time(), "", test_mode, nullptr, nullptr, 0, OK};
50 50
51 return transaction; 51 return transaction;
52 } 52 }
53 53
54 // Helper class, for use with DiskBasedCertCache::GetCertificate, that will 54 // Helper class, for use with DiskBasedCertCache::GetCertificate, that will
55 // store the returned certificate handle and allow users to WaitForResult of 55 // store the returned certificate handle and allow users to WaitForResult of
56 // DiskBasedCertCache::GetCertificate. 56 // DiskBasedCertCache::GetCertificate.
57 class TestGetCallback { 57 class TestGetCallback {
58 public: 58 public:
59 TestGetCallback() : cert_handle_(NULL) {} 59 TestGetCallback() : cert_handle_(NULL) {}
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 cache.GetCertificate(kCert1.cache_key, get_callback2.callback()); 527 cache.GetCertificate(kCert1.cache_key, get_callback2.callback());
528 get_callback2.WaitForResult(); 528 get_callback2.WaitForResult();
529 EXPECT_TRUE(X509Certificate::IsSameOSCert(get_callback2.cert_handle(), 529 EXPECT_TRUE(X509Certificate::IsSameOSCert(get_callback2.cert_handle(),
530 cert->os_cert_handle())); 530 cert->os_cert_handle()));
531 EXPECT_EQ(1U, cache.mem_cache_hits_for_testing()); 531 EXPECT_EQ(1U, cache.mem_cache_hits_for_testing());
532 ASSERT_NO_FATAL_FAILURE(CheckCertCached(&backend, kCert1)); 532 ASSERT_NO_FATAL_FAILURE(CheckCertCached(&backend, kCert1));
533 } 533 }
534 534
535 } // namespace net 535 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache.h » ('j') | net/http/http_cache_transaction.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698