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

Side by Side Diff: media/base/key_systems_unittest.cc

Issue 1052273004: Extract requestMediaKeySystemAccess() algorithm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Class vs struct forward declarations. Created 5 years, 8 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
« no previous file with comments | « media/base/key_systems.cc ('k') | media/blink/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally 5 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally
6 // shorten and improve coverage. 6 // shorten and improve coverage.
7 // - http://crbug.com/417444 7 // - http://crbug.com/417444
8 // - http://crbug.com/457438 8 // - http://crbug.com/457438
9 // TODO(sandersd): Add tests to cover codec vectors with empty items. 9 // TODO(sandersd): Add tests to cover codec vectors with empty items.
10 // http://crbug.com/417461 10 // http://crbug.com/417461
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE, 71 static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE,
72 "test codec masks should only use invalid codec masks"); 72 "test codec masks should only use invalid codec masks");
73 73
74 // Adapt IsSupportedKeySystemWithMediaMimeType() to the new API, 74 // Adapt IsSupportedKeySystemWithMediaMimeType() to the new API,
75 // IsSupportedCodecCombination(). 75 // IsSupportedCodecCombination().
76 static bool IsSupportedKeySystemWithMediaMimeType( 76 static bool IsSupportedKeySystemWithMediaMimeType(
77 const std::string& mime_type, 77 const std::string& mime_type,
78 const std::vector<std::string>& codecs, 78 const std::vector<std::string>& codecs,
79 const std::string& key_system) { 79 const std::string& key_system) {
80 return KeySystems::GetInstance().IsSupportedCodecCombination( 80 return KeySystems::GetInstance()->IsSupportedCodecCombination(
81 key_system, EmeMediaType::VIDEO, mime_type, codecs); 81 key_system, EmeMediaType::VIDEO, mime_type, codecs);
82 } 82 }
83 83
84 static bool IsSupportedKeySystemWithAudioMimeType( 84 static bool IsSupportedKeySystemWithAudioMimeType(
85 const std::string& mime_type, 85 const std::string& mime_type,
86 const std::vector<std::string>& codecs, 86 const std::vector<std::string>& codecs,
87 const std::string& key_system) { 87 const std::string& key_system) {
88 return KeySystems::GetInstance().IsSupportedCodecCombination( 88 return KeySystems::GetInstance()->IsSupportedCodecCombination(
89 key_system, EmeMediaType::AUDIO, mime_type, codecs); 89 key_system, EmeMediaType::AUDIO, mime_type, codecs);
90 } 90 }
91 91
92 // Adds test container and codec masks. 92 // Adds test container and codec masks.
93 // This function must be called after SetMediaClient() if a MediaClient will be 93 // This function must be called after SetMediaClient() if a MediaClient will be
94 // provided. 94 // provided.
95 // More details: AddXxxMask() will create KeySystems if it hasn't been created. 95 // More details: AddXxxMask() will create KeySystems if it hasn't been created.
96 // During KeySystems's construction GetMediaClient() will be used to add key 96 // During KeySystems's construction GetMediaClient() will be used to add key
97 // systems. In test code, the MediaClient is set by SetMediaClient(). 97 // systems. In test code, the MediaClient is set by SetMediaClient().
98 // Therefore, SetMediaClient() must be called before this function to make sure 98 // Therefore, SetMediaClient() must be called before this function to make sure
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); 837 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else"));
838 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); 838 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other"));
839 839
840 EXPECT_FALSE(IsSupportedKeySystem("x-")); 840 EXPECT_FALSE(IsSupportedKeySystem("x-"));
841 EXPECT_TRUE(IsSupportedKeySystem("x-something")); 841 EXPECT_TRUE(IsSupportedKeySystem("x-something"));
842 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); 842 EXPECT_FALSE(IsSupportedKeySystem("x-something.else"));
843 EXPECT_FALSE(IsSupportedKeySystem("x-other")); 843 EXPECT_FALSE(IsSupportedKeySystem("x-other"));
844 } 844 }
845 845
846 } // namespace media 846 } // namespace media
OLDNEW
« no previous file with comments | « media/base/key_systems.cc ('k') | media/blink/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698