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

Unified Diff: net/http/disk_cache_based_ssl_host_info_unittest.cc

Issue 8784003: base::Bind: Convert SSLHostInfo::WaitForDataReady. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/disk_cache_based_ssl_host_info.cc ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/disk_cache_based_ssl_host_info_unittest.cc
diff --git a/net/http/disk_cache_based_ssl_host_info_unittest.cc b/net/http/disk_cache_based_ssl_host_info_unittest.cc
index 67a1211cd7758a165d2018d0c596c82521d03c96..3e84d478f5504d600a5acfd4cca74fa5b86a9f40 100644
--- a/net/http/disk_cache_based_ssl_host_info_unittest.cc
+++ b/net/http/disk_cache_based_ssl_host_info_unittest.cc
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/compiler_specific.h"
#include "net/base/net_errors.h"
#include "net/base/ssl_config_service.h"
#include "net/http/disk_cache_based_ssl_host_info.h"
@@ -10,20 +13,6 @@
namespace {
-class DeleteSSLHostInfoOldCompletionCallback : public TestOldCompletionCallback {
- public:
- explicit DeleteSSLHostInfoOldCompletionCallback(net::SSLHostInfo* ssl_host_info)
- : ssl_host_info_(ssl_host_info) {}
-
- virtual void RunWithParams(const Tuple1<int>& params) {
- delete ssl_host_info_;
- TestOldCompletionCallback::RunWithParams(params);
- }
-
- private:
- net::SSLHostInfo* ssl_host_info_;
-};
-
// This is an empty transaction, needed to register the URL and the test mode.
const MockTransaction kHostInfoTransaction = {
"sslhostinfo:https://www.google.com",
@@ -40,8 +29,6 @@ const MockTransaction kHostInfoTransaction = {
0
};
-} // namespace
-
// Tests that we can delete a DiskCacheBasedSSLHostInfo object in a
// completion callback for DiskCacheBasedSSLHostInfo::WaitForDataReady.
TEST(DiskCacheBasedSSLHostInfo, DeleteInCallback) {
@@ -51,12 +38,12 @@ TEST(DiskCacheBasedSSLHostInfo, DeleteInCallback) {
MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
MockHttpCache cache(factory);
net::SSLConfig ssl_config;
- net::SSLHostInfo* ssl_host_info =
+ scoped_ptr<net::SSLHostInfo> ssl_host_info(
new net::DiskCacheBasedSSLHostInfo("https://www.verisign.com", ssl_config,
- &cert_verifier, cache.http_cache());
+ &cert_verifier, cache.http_cache()));
ssl_host_info->Start();
- DeleteSSLHostInfoOldCompletionCallback callback(ssl_host_info);
- int rv = ssl_host_info->WaitForDataReady(&callback);
+ net::TestCompletionCallback callback;
+ int rv = ssl_host_info->WaitForDataReady(callback.callback());
EXPECT_EQ(net::ERR_IO_PENDING, rv);
// Now complete the backend creation and let the callback run.
factory->FinishCreation();
@@ -67,7 +54,7 @@ TEST(DiskCacheBasedSSLHostInfo, DeleteInCallback) {
TEST(DiskCacheBasedSSLHostInfo, Update) {
MockHttpCache cache;
AddMockTransaction(&kHostInfoTransaction);
- TestOldCompletionCallback callback;
+ net::TestCompletionCallback callback;
// Store a certificate chain.
net::CertVerifier cert_verifier;
@@ -76,7 +63,7 @@ TEST(DiskCacheBasedSSLHostInfo, Update) {
new net::DiskCacheBasedSSLHostInfo("https://www.google.com", ssl_config,
&cert_verifier, cache.http_cache()));
ssl_host_info->Start();
- int rv = ssl_host_info->WaitForDataReady(&callback);
+ int rv = ssl_host_info->WaitForDataReady(callback.callback());
EXPECT_EQ(net::OK, callback.GetResult(rv));
net::SSLHostInfo::State* state = ssl_host_info->mutable_state();
@@ -92,7 +79,7 @@ TEST(DiskCacheBasedSSLHostInfo, Update) {
new net::DiskCacheBasedSSLHostInfo("https://www.google.com", ssl_config,
&cert_verifier, cache.http_cache()));
ssl_host_info->Start();
- rv = ssl_host_info->WaitForDataReady(&callback);
+ rv = ssl_host_info->WaitForDataReady(callback.callback());
EXPECT_EQ(net::OK, callback.GetResult(rv));
// And now update the data.
@@ -111,7 +98,7 @@ TEST(DiskCacheBasedSSLHostInfo, Update) {
new net::DiskCacheBasedSSLHostInfo("https://www.google.com", ssl_config,
&cert_verifier, cache.http_cache()));
ssl_host_info->Start();
- rv = ssl_host_info->WaitForDataReady(&callback);
+ rv = ssl_host_info->WaitForDataReady(callback.callback());
EXPECT_EQ(net::OK, callback.GetResult(rv));
state = ssl_host_info->mutable_state();
@@ -121,3 +108,5 @@ TEST(DiskCacheBasedSSLHostInfo, Update) {
RemoveMockTransaction(&kHostInfoTransaction);
}
+
+} // namespace
« no previous file with comments | « net/http/disk_cache_based_ssl_host_info.cc ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698