OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" | 5 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "net/base/mime_util.h" | 8 #include "net/base/mime_util.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 media_map_.insert("application/ogg"); | 30 media_map_.insert("application/ogg"); |
31 codecs_map_.insert("theora"); | 31 codecs_map_.insert("theora"); |
32 codecs_map_.insert("vorbis"); | 32 codecs_map_.insert("vorbis"); |
33 | 33 |
34 // Claim we support WAV. | 34 // Claim we support WAV. |
35 media_map_.insert("audio/wav"); | 35 media_map_.insert("audio/wav"); |
36 media_map_.insert("audio/x-wav"); | 36 media_map_.insert("audio/x-wav"); |
37 codecs_map_.insert("1"); // PCM for WAV. | 37 codecs_map_.insert("1"); // PCM for WAV. |
38 } | 38 } |
39 | 39 |
| 40 TestShellWebMimeRegistryImpl::~TestShellWebMimeRegistryImpl() {} |
| 41 |
40 WebMimeRegistry::SupportsType | 42 WebMimeRegistry::SupportsType |
41 TestShellWebMimeRegistryImpl::supportsMediaMIMEType( | 43 TestShellWebMimeRegistryImpl::supportsMediaMIMEType( |
42 const WebString& mime_type, const WebString& codecs) { | 44 const WebString& mime_type, const WebString& codecs) { |
43 // Not supporting the container is a flat-out no. | 45 // Not supporting the container is a flat-out no. |
44 if (!IsSupportedMediaMimeType(ToASCIIOrEmpty(mime_type).c_str())) | 46 if (!IsSupportedMediaMimeType(ToASCIIOrEmpty(mime_type).c_str())) |
45 return IsNotSupported; | 47 return IsNotSupported; |
46 | 48 |
47 // If we don't recognize the codec, it's possible we support it. | 49 // If we don't recognize the codec, it's possible we support it. |
48 std::vector<std::string> parsed_codecs; | 50 std::vector<std::string> parsed_codecs; |
49 net::ParseCodecString(ToASCIIOrEmpty(codecs).c_str(), &parsed_codecs, true); | 51 net::ParseCodecString(ToASCIIOrEmpty(codecs).c_str(), &parsed_codecs, true); |
(...skipping 11 matching lines...) Expand all Loading... |
61 | 63 |
62 bool TestShellWebMimeRegistryImpl::AreSupportedMediaCodecs( | 64 bool TestShellWebMimeRegistryImpl::AreSupportedMediaCodecs( |
63 const std::vector<std::string>& codecs) { | 65 const std::vector<std::string>& codecs) { |
64 for (size_t i = 0; i < codecs.size(); ++i) { | 66 for (size_t i = 0; i < codecs.size(); ++i) { |
65 if (codecs_map_.find(codecs[i]) == codecs_map_.end()) { | 67 if (codecs_map_.find(codecs[i]) == codecs_map_.end()) { |
66 return false; | 68 return false; |
67 } | 69 } |
68 } | 70 } |
69 return true; | 71 return true; |
70 } | 72 } |
OLD | NEW |