Chromium Code Reviews| Index: third_party/WebKit/Source/platform/network/mime/MockMimeRegistry.h |
| diff --git a/third_party/WebKit/Source/platform/network/mime/MockMimeRegistry.h b/third_party/WebKit/Source/platform/network/mime/MockMimeRegistry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ce8d0e54b1f56d52051ea21d796d44087d9eaaaf |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/network/mime/MockMimeRegistry.h |
| @@ -0,0 +1,32 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef MockMimeRegistry_h |
| +#define MockMimeRegistry_h |
| + |
| +#include "mojo/public/cpp/bindings/binding.h" |
|
Reilly Grant (use Gerrit)
2016/10/28 01:35:44
nit: This header is no longer used.
kinuko
2016/10/28 15:03:32
Done.
|
| +#include "net/base/mime_util.h" |
| +#include "public/platform/FilePathConversion.h" |
| +#include "public/platform/mime_registry.mojom-blink.h" |
| + |
| +namespace blink { |
| + |
| +// Used for unit tests. |
| +class MockMimeRegistry : public mojom::blink::MimeRegistry { |
| + public: |
| + MockMimeRegistry() = default; |
| + ~MockMimeRegistry() = default; |
| + |
| + void GetMimeTypeFromExtension( |
| + const String& ext, |
| + const GetMimeTypeFromExtensionCallback& callback) override { |
| + std::string mimeType; |
| + net::GetMimeTypeFromExtension(WebStringToFilePath(ext).value(), &mimeType); |
| + callback.Run(String::fromUTF8(mimeType.data(), mimeType.length())); |
| + } |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // MockMimeRegistry_h |