OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MockMimeRegistry_h |
| 6 #define MockMimeRegistry_h |
| 7 |
| 8 #include "net/base/mime_util.h" |
| 9 #include "public/platform/FilePathConversion.h" |
| 10 #include "public/platform/mime_registry.mojom-blink.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 // Used for unit tests. |
| 15 class MockMimeRegistry : public mojom::blink::MimeRegistry { |
| 16 public: |
| 17 MockMimeRegistry() = default; |
| 18 ~MockMimeRegistry() = default; |
| 19 |
| 20 void GetMimeTypeFromExtension( |
| 21 const String& ext, |
| 22 const GetMimeTypeFromExtensionCallback& callback) override { |
| 23 std::string mimeType; |
| 24 net::GetMimeTypeFromExtension(WebStringToFilePath(ext).value(), &mimeType); |
| 25 callback.Run(String::fromUTF8(mimeType.data(), mimeType.length())); |
| 26 } |
| 27 }; |
| 28 |
| 29 } // namespace blink |
| 30 |
| 31 #endif // MockMimeRegistry_h |
OLD | NEW |