Chromium Code Reviews| Index: media/test/pipeline_integration_test.cc |
| diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc |
| index 84616eafc44192a9d7a9e504923bef7a4ad33245..08f868a99a10e35722ebce21196573124ea490ad 100644 |
| --- a/media/test/pipeline_integration_test.cc |
| +++ b/media/test/pipeline_integration_test.cc |
| @@ -105,14 +105,6 @@ const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
| const char kMP3[] = "audio/mpeg"; |
| #endif // defined(USE_PROPRIETARY_CODECS) |
| -// Key used to encrypt test files. |
| -const uint8_t kSecretKey[] = {0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, |
| - 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c}; |
| - |
| -// The key ID for all encrypted files. |
| -const uint8_t kKeyId[] = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| - 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35}; |
| - |
| const size_t kAppendWholeFile = std::numeric_limits<size_t>::max(); |
| // Constants for the Media Source config change tests. |
| @@ -284,7 +276,7 @@ class FakeEncryptedMedia { |
| enum PromiseResult { RESOLVED, REJECTED }; |
| -// Provides |kSecretKey| in response to the encrypted event. |
| +// Provides test key in response to the encrypted event. |
|
ddorwin
2016/04/12 00:40:48
nit: insert "the"
dougsteed
2016/05/08 23:18:45
Done.
|
| class KeyProvidingApp : public FakeEncryptedMedia::AppBase { |
| public: |
| KeyProvidingApp() {} |
| @@ -387,11 +379,8 @@ class KeyProvidingApp : public FakeEncryptedMedia::AppBase { |
| virtual bool LookupKey(const std::vector<uint8_t>& key_id, |
| std::vector<uint8_t>* key) { |
| - // As there is no key rotation, the key ID provided should be |kKeyId| |
| - // which uses |kSecretKey| as the key. |
| - EXPECT_EQ(std::vector<uint8_t>(kKeyId, kKeyId + arraysize(kKeyId)), key_id); |
| - key->assign(kSecretKey, kSecretKey + arraysize(kSecretKey)); |
| - return true; |
| + // No key rotation. |
| + return LookupTestKey(key_id, key, false); |
| } |
| std::string current_session_id_; |
| @@ -423,22 +412,8 @@ class RotatingKeyProvidingApp : public KeyProvidingApp { |
| bool LookupKey(const std::vector<uint8_t>& key_id, |
| std::vector<uint8_t>* key) override { |
| - // The Key and KeyId for this testing key provider are created by left |
| - // rotating |kSecretKey| and |kKeyId|. Note that this implementation is |
| - // only intended for testing purpose. The actual key rotation algorithm |
| - // can be much more complicated. |
| - // Find out the rotating position from |starting_key_id| and apply on |key|. |
| - std::vector<uint8_t> starting_key_id(kKeyId, kKeyId + arraysize(kKeyId)); |
| - for (size_t pos = 0; pos < starting_key_id.size(); ++pos) { |
| - std::rotate(starting_key_id.begin(), starting_key_id.begin() + pos, |
| - starting_key_id.end()); |
| - if (key_id == starting_key_id) { |
| - key->assign(kSecretKey, kSecretKey + arraysize(kSecretKey)); |
| - std::rotate(key->begin(), key->begin() + pos, key->end()); |
| - return true; |
| - } |
| - } |
| - return false; |
| + // With key rotation. |
| + return LookupTestKey(key_id, key, true); |
| } |
| uint32_t num_distinct_need_key_calls_; |