OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/filters/pipeline_integration_test_base.h" | 5 #include "media/filters/pipeline_integration_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Defines the behavior of the "app" that responds to EME events. | 112 // Defines the behavior of the "app" that responds to EME events. |
113 class AppBase { | 113 class AppBase { |
114 public: | 114 public: |
115 virtual ~AppBase() {} | 115 virtual ~AppBase() {} |
116 | 116 |
117 virtual void OnSessionCreated(uint32 session_id, | 117 virtual void OnSessionCreated(uint32 session_id, |
118 const std::string& web_session_id) = 0; | 118 const std::string& web_session_id) = 0; |
119 | 119 |
120 virtual void OnSessionMessage(uint32 session_id, | 120 virtual void OnSessionMessage(uint32 session_id, |
121 const std::vector<uint8>& message, | 121 const std::vector<uint8>& message, |
122 const std::string& destination_url) = 0; | 122 const GURL& destination_url) = 0; |
123 | 123 |
124 virtual void OnSessionReady(uint32 session_id) = 0; | 124 virtual void OnSessionReady(uint32 session_id) = 0; |
125 | 125 |
126 virtual void OnSessionClosed(uint32 session_id) = 0; | 126 virtual void OnSessionClosed(uint32 session_id) = 0; |
127 | 127 |
128 // Errors are not expected unless overridden. | 128 // Errors are not expected unless overridden. |
129 virtual void OnSessionError(uint32 session_id, | 129 virtual void OnSessionError(uint32 session_id, |
130 MediaKeys::KeyError error_code, | 130 MediaKeys::KeyError error_code, |
131 uint32 system_code) { | 131 uint32 system_code) { |
132 FAIL() << "Unexpected Key Error"; | 132 FAIL() << "Unexpected Key Error"; |
(...skipping 21 matching lines...) Expand all Loading... |
154 return &decryptor_; | 154 return &decryptor_; |
155 } | 155 } |
156 | 156 |
157 // Callbacks for firing session events. Delegate to |app_|. | 157 // Callbacks for firing session events. Delegate to |app_|. |
158 void OnSessionCreated(uint32 session_id, const std::string& web_session_id) { | 158 void OnSessionCreated(uint32 session_id, const std::string& web_session_id) { |
159 app_->OnSessionCreated(session_id, web_session_id); | 159 app_->OnSessionCreated(session_id, web_session_id); |
160 } | 160 } |
161 | 161 |
162 void OnSessionMessage(uint32 session_id, | 162 void OnSessionMessage(uint32 session_id, |
163 const std::vector<uint8>& message, | 163 const std::vector<uint8>& message, |
164 const std::string& destination_url) { | 164 const GURL& destination_url) { |
165 app_->OnSessionMessage(session_id, message, destination_url); | 165 app_->OnSessionMessage(session_id, message, destination_url); |
166 } | 166 } |
167 | 167 |
168 void OnSessionReady(uint32 session_id) { | 168 void OnSessionReady(uint32 session_id) { |
169 app_->OnSessionReady(session_id); | 169 app_->OnSessionReady(session_id); |
170 } | 170 } |
171 | 171 |
172 void OnSessionClosed(uint32 session_id) { | 172 void OnSessionClosed(uint32 session_id) { |
173 app_->OnSessionClosed(session_id); | 173 app_->OnSessionClosed(session_id); |
174 } | 174 } |
(...skipping 20 matching lines...) Expand all Loading... |
195 KeyProvidingApp() : current_session_id_(0) {} | 195 KeyProvidingApp() : current_session_id_(0) {} |
196 | 196 |
197 virtual void OnSessionCreated(uint32 session_id, | 197 virtual void OnSessionCreated(uint32 session_id, |
198 const std::string& web_session_id) OVERRIDE { | 198 const std::string& web_session_id) OVERRIDE { |
199 EXPECT_GT(session_id, 0u); | 199 EXPECT_GT(session_id, 0u); |
200 EXPECT_FALSE(web_session_id.empty()); | 200 EXPECT_FALSE(web_session_id.empty()); |
201 } | 201 } |
202 | 202 |
203 virtual void OnSessionMessage(uint32 session_id, | 203 virtual void OnSessionMessage(uint32 session_id, |
204 const std::vector<uint8>& message, | 204 const std::vector<uint8>& message, |
205 const std::string& default_url) OVERRIDE { | 205 const GURL& default_url) OVERRIDE { |
206 EXPECT_GT(session_id, 0u); | 206 EXPECT_GT(session_id, 0u); |
207 EXPECT_FALSE(message.empty()); | 207 EXPECT_FALSE(message.empty()); |
208 | 208 |
209 current_session_id_ = session_id; | 209 current_session_id_ = session_id; |
210 } | 210 } |
211 | 211 |
212 virtual void OnSessionReady(uint32 session_id) OVERRIDE { | 212 virtual void OnSessionReady(uint32 session_id) OVERRIDE { |
213 EXPECT_GT(session_id, 0u); | 213 EXPECT_GT(session_id, 0u); |
214 } | 214 } |
215 | 215 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 class NoResponseApp : public FakeEncryptedMedia::AppBase { | 322 class NoResponseApp : public FakeEncryptedMedia::AppBase { |
323 public: | 323 public: |
324 virtual void OnSessionCreated(uint32 session_id, | 324 virtual void OnSessionCreated(uint32 session_id, |
325 const std::string& web_session_id) OVERRIDE { | 325 const std::string& web_session_id) OVERRIDE { |
326 EXPECT_GT(session_id, 0u); | 326 EXPECT_GT(session_id, 0u); |
327 EXPECT_FALSE(web_session_id.empty()); | 327 EXPECT_FALSE(web_session_id.empty()); |
328 } | 328 } |
329 | 329 |
330 virtual void OnSessionMessage(uint32 session_id, | 330 virtual void OnSessionMessage(uint32 session_id, |
331 const std::vector<uint8>& message, | 331 const std::vector<uint8>& message, |
332 const std::string& default_url) OVERRIDE { | 332 const GURL& default_url) OVERRIDE { |
333 EXPECT_GT(session_id, 0u); | 333 EXPECT_GT(session_id, 0u); |
334 EXPECT_FALSE(message.empty()); | 334 EXPECT_FALSE(message.empty()); |
335 FAIL() << "Unexpected KeyMessage"; | 335 FAIL() << "Unexpected KeyMessage"; |
336 } | 336 } |
337 | 337 |
338 virtual void OnSessionReady(uint32 session_id) OVERRIDE { | 338 virtual void OnSessionReady(uint32 session_id) OVERRIDE { |
339 EXPECT_GT(session_id, 0u); | 339 EXPECT_GT(session_id, 0u); |
340 FAIL() << "Unexpected Ready"; | 340 FAIL() << "Unexpected Ready"; |
341 } | 341 } |
342 | 342 |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 } | 1445 } |
1446 | 1446 |
1447 // For MediaSource tests, generate two sets of tests: one using FrameProcessor, | 1447 // For MediaSource tests, generate two sets of tests: one using FrameProcessor, |
1448 // and one using LegacyFrameProcessor. | 1448 // and one using LegacyFrameProcessor. |
1449 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, PipelineIntegrationTest, | 1449 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, PipelineIntegrationTest, |
1450 Values(false)); | 1450 Values(false)); |
1451 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, | 1451 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, |
1452 Values(true)); | 1452 Values(true)); |
1453 | 1453 |
1454 } // namespace media | 1454 } // namespace media |
OLD | NEW |