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

Unified Diff: webkit/tools/test_shell/test_shell_webmimeregistry_impl.cc

Issue 15946006: Move C++ code from webkit/tools/test_shell to webkit/support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix npapi_test_plugin Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/test_shell_webmimeregistry_impl.h ('k') | webkit/webkit.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/test_shell_webmimeregistry_impl.cc
diff --git a/webkit/tools/test_shell/test_shell_webmimeregistry_impl.cc b/webkit/tools/test_shell/test_shell_webmimeregistry_impl.cc
deleted file mode 100644
index 06a880bc57727303070398a205264aa74105e8fc..0000000000000000000000000000000000000000
--- a/webkit/tools/test_shell/test_shell_webmimeregistry_impl.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h"
-
-#include "base/basictypes.h"
-#include "base/string_util.h"
-#include "net/base/mime_util.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-using WebKit::WebString;
-using WebKit::WebMimeRegistry;
-
-namespace {
-
-// Convert a WebString to ASCII, falling back on an empty string in the case
-// of a non-ASCII string.
-std::string ToASCIIOrEmpty(const WebString& string) {
- return IsStringASCII(string) ? UTF16ToASCII(string) : std::string();
-}
-
-} // namespace
-
-TestShellWebMimeRegistryImpl::TestShellWebMimeRegistryImpl() {
- net::GetMediaTypesBlacklistedForTests(&blacklisted_media_types_);
-
- net::GetMediaCodecsBlacklistedForTests(&blacklisted_media_codecs_);
-}
-
-TestShellWebMimeRegistryImpl::~TestShellWebMimeRegistryImpl() {}
-
-// Returns IsNotSupported if mime_type or any of the codecs are not supported.
-// Otherwse, defers to the real registry.
-WebMimeRegistry::SupportsType
-TestShellWebMimeRegistryImpl::supportsMediaMIMEType(
- const WebString& mime_type,
- const WebString& codecs,
- const WebKit::WebString& key_system) {
- if (IsBlacklistedMediaMimeType(ToASCIIOrEmpty(mime_type)))
- return IsNotSupported;
-
- std::vector<std::string> parsed_codecs;
- net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true);
- if (HasBlacklistedMediaCodecs(parsed_codecs))
- return IsNotSupported;
-
- return SimpleWebMimeRegistryImpl::supportsMediaMIMEType(
- mime_type, codecs, key_system);
-}
-
-bool TestShellWebMimeRegistryImpl::IsBlacklistedMediaMimeType(
- const std::string& mime_type) {
- for (size_t i = 0; i < blacklisted_media_types_.size(); ++i) {
- if (blacklisted_media_types_[i] == mime_type)
- return true;
- }
- return false;
-}
-
-bool TestShellWebMimeRegistryImpl::HasBlacklistedMediaCodecs(
- const std::vector<std::string>& codecs) {
- for (size_t i = 0; i < codecs.size(); ++i) {
- for (size_t j = 0; j < blacklisted_media_codecs_.size(); ++j) {
- if (blacklisted_media_codecs_[j] == codecs[i])
- return true;
- }
- }
- return false;
-}
« no previous file with comments | « webkit/tools/test_shell/test_shell_webmimeregistry_impl.h ('k') | webkit/webkit.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698