Chromium Code Reviews| 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 "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.
| |
| 9 #include "net/base/mime_util.h" | |
| 10 #include "public/platform/FilePathConversion.h" | |
| 11 #include "public/platform/mime_registry.mojom-blink.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 // Used for unit tests. | |
| 16 class MockMimeRegistry : public mojom::blink::MimeRegistry { | |
| 17 public: | |
| 18 MockMimeRegistry() = default; | |
| 19 ~MockMimeRegistry() = default; | |
| 20 | |
| 21 void GetMimeTypeFromExtension( | |
| 22 const String& ext, | |
| 23 const GetMimeTypeFromExtensionCallback& callback) override { | |
| 24 std::string mimeType; | |
| 25 net::GetMimeTypeFromExtension(WebStringToFilePath(ext).value(), &mimeType); | |
| 26 callback.Run(String::fromUTF8(mimeType.data(), mimeType.length())); | |
| 27 } | |
| 28 }; | |
| 29 | |
| 30 } // namespace blink | |
| 31 | |
| 32 #endif // MockMimeRegistry_h | |
| OLD | NEW |