OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 : mojo_cdm_service_(base::MakeUnique<MojoCdmService>( | 51 : mojo_cdm_service_(base::MakeUnique<MojoCdmService>( |
52 mojo_cdm_service_context_.GetWeakPtr(), | 52 mojo_cdm_service_context_.GetWeakPtr(), |
53 &cdm_factory_)), | 53 &cdm_factory_)), |
54 cdm_binding_(mojo_cdm_service_.get()) {} | 54 cdm_binding_(mojo_cdm_service_.get()) {} |
55 | 55 |
56 virtual ~MojoCdmTest() {} | 56 virtual ~MojoCdmTest() {} |
57 | 57 |
58 void Initialize(const std::string& key_system, | 58 void Initialize(const std::string& key_system, |
59 ExpectedResult expected_result) { | 59 ExpectedResult expected_result) { |
60 mojom::ContentDecryptionModulePtr remote_cdm; | 60 mojom::ContentDecryptionModulePtr remote_cdm; |
61 auto cdm_request = mojo::GetProxy(&remote_cdm); | 61 auto cdm_request = mojo::MakeRequest(&remote_cdm); |
62 | 62 |
63 switch (expected_result) { | 63 switch (expected_result) { |
64 case SUCCESS: | 64 case SUCCESS: |
65 case FAILURE: | 65 case FAILURE: |
66 cdm_binding_.Bind(std::move(cdm_request)); | 66 cdm_binding_.Bind(std::move(cdm_request)); |
67 break; | 67 break; |
68 case CONNECTION_ERROR: | 68 case CONNECTION_ERROR: |
69 cdm_request.ResetWithReason(0, "Request dropped for testing."); | 69 cdm_request.ResetWithReason(0, "Request dropped for testing."); |
70 break; | 70 break; |
71 } | 71 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 TEST_F(MojoCdmTest, CloseSession_AfterConnectionError) { | 209 TEST_F(MojoCdmTest, CloseSession_AfterConnectionError) { |
210 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); | 210 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); |
211 | 211 |
212 Initialize(kClearKeyKeySystem, SUCCESS); | 212 Initialize(kClearKeyKeySystem, SUCCESS); |
213 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); | 213 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); |
214 ForceConnectionError(); | 214 ForceConnectionError(); |
215 CloseSessionAndExpect(FAILURE); | 215 CloseSessionAndExpect(FAILURE); |
216 } | 216 } |
217 | 217 |
218 } // namespace media | 218 } // namespace media |
OLD | NEW |