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

Side by Side Diff: ios/web/net/cert_verifier_block_adapter_unittest.cc

Issue 1392143003: Allways call didReceiveAuthenticationChallenge: completion handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a unittest; Updated comments; Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/web/net/cert_verifier_block_adapter.h" 5 #include "ios/web/net/cert_verifier_block_adapter.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/test/ios/wait_util.h" 8 #include "base/test/ios/wait_util.h"
9 #include "ios/web/public/test/test_web_thread_bundle.h" 9 #include "ios/web/public/test/test_web_thread_bundle.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // Call |Verify|. 141 // Call |Verify|.
142 net::CertVerifyResult actual_result; 142 net::CertVerifyResult actual_result;
143 int actual_error = -1; 143 int actual_error = -1;
144 CertVerifierBlockAdapter::Params params(cert_.get(), kHostName); 144 CertVerifierBlockAdapter::Params params(cert_.get(), kHostName);
145 Verify(&test_adapter, params, &actual_result, &actual_error); 145 Verify(&test_adapter, params, &actual_result, &actual_error);
146 146
147 // Ensure that Verification results are correct. 147 // Ensure that Verification results are correct.
148 EXPECT_EQ(kExpectedError, actual_error); 148 EXPECT_EQ(kExpectedError, actual_error);
149 } 149 }
150 150
151 // Tests that |Verify| completion handler is called even if adapter is
152 // destroyed.
Ryan Sleevi 2015/10/28 18:32:27 comment nit: Missing some articles // Tests that
Eugene But (OOO till 7-30) 2015/10/29 15:43:38 Done.
153 TEST_F(CertVerifierBlockAdapterTest, CompletionHandlerIsAlwaysCalled) {
154 scoped_ptr<net::CertVerifier> verifier(net::CertVerifier::CreateDefault());
155 scoped_ptr<CertVerifierBlockAdapter> test_adapter(
156 new CertVerifierBlockAdapter(verifier.get(), &net_log_));
157
158 // Call |Verify| and destroy adapter.
Ryan Sleevi 2015/10/28 18:32:27 s/destroy adapter/destroy the adapter/
Eugene But (OOO till 7-30) 2015/10/29 15:43:38 Done.
159 CertVerifierBlockAdapter::Params params(cert_.get(), kHostName);
160 __block bool verification_completed = false;
161 test_adapter->Verify(params, ^(net::CertVerifyResult, int) {
162 verification_completed = true;
163 });
164 test_adapter.reset();
165
166 // Make sure that completion handler is called.
Ryan Sleevi 2015/10/28 18:32:27 s/that completion/that the completion/
Eugene But (OOO till 7-30) 2015/10/29 15:43:38 Done.
167 base::test::ios::WaitUntilCondition(^{
168 return verification_completed;
169 }, base::MessageLoop::current(), base::TimeDelta());
170 }
171
151 } // namespace web 172 } // namespace web
OLDNEW
« ios/web/net/cert_verifier_block_adapter.cc ('K') | « ios/web/net/cert_verifier_block_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698