chromium/content/web_test/renderer/test_plugin.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "content/web_test/renderer/test_plugin.h"

#include <stddef.h>
#include <stdint.h>

#include <utility>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "cc/layers/texture_layer.h"
#include "cc/resources/cross_thread_shared_bitmap.h"
#include "components/viz/common/resources/bitmap_allocation.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "content/web_test/renderer/test_runner.h"
#include "content/web_test/renderer/web_frame_test_proxy.h"
#include "gin/handle.h"
#include "gin/interceptor.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/ipc/client/client_shared_image_interface.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/input/web_coalesced_input_event.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_touch_event.h"
#include "third_party/blink/public/common/input/web_touch_point.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/platform/web_graphics_context_3d_provider.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_plugin_params.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"

namespace content {

namespace {

void PremultiplyAlpha(const uint8_t color_in[3],
                      float alpha,
                      float color_out[4]) {}

const char* PointState(blink::WebTouchPoint::State state) {}

void PrintTouchList(TestRunner* test_runner,
                    WebFrameTestProxy& frame_proxy,
                    base::span<const blink::WebTouchPoint> points) {}

void PrintEventDetails(TestRunner* test_runner,
                       WebFrameTestProxy& frame_proxy,
                       const blink::WebInputEvent& event) {}

blink::WebPluginContainer::TouchEventRequestType ParseTouchEventRequestType(
    const blink::WebString& string) {}

class ScriptableObject : public gin::Wrappable<ScriptableObject>,
                         public gin::NamedPropertyInterceptor {};

// static
gin::WrapperInfo ScriptableObject::kWrapperInfo =;

}  // namespace

TestPlugin::TestPlugin(const blink::WebPluginParams& params,
                       TestRunner* test_runner,
                       blink::WebLocalFrame* frame)
    :{}

TestPlugin::~TestPlugin() {}

bool TestPlugin::Initialize(blink::WebPluginContainer* container) {}

void TestPlugin::Destroy() {}

blink::WebPluginContainer* TestPlugin::Container() const {}

bool TestPlugin::CanProcessDrag() const {}

bool TestPlugin::SupportsKeyboardFocus() const {}

void TestPlugin::UpdateGeometry(const gfx::Rect& window_rect,
                                const gfx::Rect& clip_rect,
                                const gfx::Rect& unobscured_rect,
                                bool is_visible) {}

v8::Local<v8::Object> TestPlugin::V8ScriptableObject(v8::Isolate* isolate) {}

// static
void TestPlugin::ReleaseSharedMemory(
    scoped_refptr<cc::CrossThreadSharedBitmap> shared_bitmap,
    cc::SharedBitmapIdRegistration registration,
    const gpu::SyncToken& sync_token,
    bool lost) {}

// static
void TestPlugin::ReleaseSharedImage(
    scoped_refptr<gpu::ClientSharedImage> shared_image,
    const gpu::SyncToken& sync_token,
    bool lost) {}

bool TestPlugin::PrepareTransferableResource(
    cc::SharedBitmapIdRegistrar* bitmap_registrar,
    viz::TransferableResource* resource,
    viz::ReleaseCallback* release_callback) {}

TestPlugin::Primitive TestPlugin::ParsePrimitive(
    const blink::WebString& string) {}

// FIXME: This method should already exist. Use it.
// For now just parse primary colors.
void TestPlugin::ParseColor(const blink::WebString& string, uint8_t color[3]) {}

float TestPlugin::ParseOpacity(const blink::WebString& string) {}

bool TestPlugin::ParseBoolean(const blink::WebString& string) {}

bool TestPlugin::InitScene() {}

void TestPlugin::DrawSceneGL() {}

void TestPlugin::DrawSceneSoftware(void* memory) {}

void TestPlugin::DestroyScene() {}

bool TestPlugin::InitProgram() {}

bool TestPlugin::InitPrimitive() {}

void TestPlugin::DrawPrimitive() {}

GLuint TestPlugin::LoadShader(GLenum type, const std::string& source) {}

GLuint TestPlugin::LoadProgram(const std::string& vertex_source,
                               const std::string& fragment_source) {}

blink::WebInputEventResult TestPlugin::HandleInputEvent(
    const blink::WebCoalescedInputEvent& coalesced_event,
    ui::Cursor* cursor) {}

bool TestPlugin::HandleDragStatusUpdate(blink::WebDragStatus drag_status,
                                        const blink::WebDragData& data,
                                        blink::DragOperationsMask mask,
                                        const gfx::PointF& position,
                                        const gfx::PointF& screen_position) {}

TestPlugin* TestPlugin::Create(const blink::WebPluginParams& params,
                               TestRunner* test_runner,
                               blink::WebLocalFrame* frame) {}

const blink::WebString& TestPlugin::MimeType() {}

const blink::WebString& TestPlugin::PluginPersistsMimeType() {}

bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) {}

}  // namespace content