OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 RTC_CHECK(signaling_thread_); | 29 RTC_CHECK(signaling_thread_); |
30 RTC_CHECK(worker_thread_->Start()); | 30 RTC_CHECK(worker_thread_->Start()); |
31 generator_.reset( | 31 generator_.reset( |
32 new RTCCertificateGenerator(signaling_thread_, worker_thread_.get())); | 32 new RTCCertificateGenerator(signaling_thread_, worker_thread_.get())); |
33 } | 33 } |
34 ~RTCCertificateGeneratorFixture() override {} | 34 ~RTCCertificateGeneratorFixture() override {} |
35 | 35 |
36 RTCCertificateGenerator* generator() const { return generator_.get(); } | 36 RTCCertificateGenerator* generator() const { return generator_.get(); } |
37 RTCCertificate* certificate() const { return certificate_.get(); } | 37 RTCCertificate* certificate() const { return certificate_.get(); } |
38 | 38 |
39 void OnSuccess(const scoped_refptr<RTCCertificate>& certificate) override { | 39 void OnSuccess(const scoped_refptr<RTCCertificate>& certificate) { |
40 RTC_CHECK(signaling_thread_->IsCurrent()); | 40 RTC_CHECK(signaling_thread_->IsCurrent()); |
41 RTC_CHECK(certificate); | 41 RTC_CHECK(certificate); |
42 certificate_ = certificate; | 42 certificate_ = certificate; |
43 generate_async_completed_ = true; | 43 generate_async_completed_ = true; |
44 } | 44 } |
45 void OnFailure() override { | 45 void OnFailure() { |
46 RTC_CHECK(signaling_thread_->IsCurrent()); | 46 RTC_CHECK(signaling_thread_->IsCurrent()); |
47 certificate_ = nullptr; | 47 certificate_ = nullptr; |
48 generate_async_completed_ = true; | 48 generate_async_completed_ = true; |
49 } | 49 } |
50 | 50 |
51 bool GenerateAsyncCompleted() { | 51 bool GenerateAsyncCompleted() { |
52 RTC_CHECK(signaling_thread_->IsCurrent()); | 52 RTC_CHECK(signaling_thread_->IsCurrent()); |
53 if (generate_async_completed_) { | 53 if (generate_async_completed_) { |
54 // Reset flag so that future generation requests are not considered done. | 54 // Reset flag so that future generation requests are not considered done. |
55 generate_async_completed_ = false; | 55 generate_async_completed_ = false; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 fixture_->generator()->GenerateCertificateAsync( | 144 fixture_->generator()->GenerateCertificateAsync( |
145 invalid_params, | 145 invalid_params, |
146 Optional<uint64_t>(), | 146 Optional<uint64_t>(), |
147 fixture_); | 147 fixture_); |
148 EXPECT_TRUE_WAIT(fixture_->GenerateAsyncCompleted(), kGenerationTimeoutMs); | 148 EXPECT_TRUE_WAIT(fixture_->GenerateAsyncCompleted(), kGenerationTimeoutMs); |
149 EXPECT_FALSE(fixture_->certificate()); | 149 EXPECT_FALSE(fixture_->certificate()); |
150 } | 150 } |
151 | 151 |
152 } // namespace rtc | 152 } // namespace rtc |
OLD | NEW |