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

Unified Diff: third_party/WebKit/Source/platform/network/mime/MockMimeRegistry.h

Issue 2444873002: Move WebMIMERegistry impl from //content to blink:platform/network/mime (Closed)
Patch Set: remove indirection Created 4 years, 2 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
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..d41ff932da7ec6e25e913ddb604347361a857163
--- /dev/null
+++ b/third_party/WebKit/Source/platform/network/mime/MockMimeRegistry.h
@@ -0,0 +1,35 @@
+// 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"
+#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(mojom::blink::MimeRegistryRequest request)
+ : m_binding(this, std::move(request)) {}
+ ~MockMimeRegistry() {}
+
+ 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()));
+ }
+
+ mojo::Binding<mojom::blink::MimeRegistry> m_binding;
+};
+
+} // namespace blink
+
+#endif // MockMimeRegistry_h

Powered by Google App Engine
This is Rietveld 408576698