blob: 3e592563cf3bd72d755977419cef774ab2893d91 [file] [log] [blame]
// Copyright 2013 The Flutter 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 "windows_unit_tests_plugin.h"
#include <flutter/method_channel.h>
#include <flutter/plugin_registrar_windows.h>
#include <flutter/standard_method_codec.h>
#include <memory>
namespace windows_unit_tests {
// static
void WindowsUnitTestsPlugin::RegisterWithRegistrar(
flutter::PluginRegistrarWindows *registrar) {
auto channel =
std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
registrar->messenger(), "windows_unit_tests",
&flutter::StandardMethodCodec::GetInstance());
auto plugin = std::make_unique<WindowsUnitTestsPlugin>();
channel->SetMethodCallHandler(
[plugin_pointer = plugin.get()](const auto &call, auto result) {
plugin_pointer->HandleMethodCall(call, std::move(result));
});
registrar->AddPlugin(std::move(plugin));
}
WindowsUnitTestsPlugin::WindowsUnitTestsPlugin() {}
WindowsUnitTestsPlugin::~WindowsUnitTestsPlugin() {}
void WindowsUnitTestsPlugin::HandleMethodCall(
const flutter::MethodCall<flutter::EncodableValue> &method_call,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
if (method_call.method_name().compare("placeholder") == 0) {
result->Success(flutter::EncodableValue(true));
} else {
result->NotImplemented();
}
}
} // namespace windows_unit_tests