55#define FML_USED_ON_EMBEDDER
66
77#include " flutter/shell/common/shell_test.h"
8+ #include " flutter/shell/common/shell_test_platform_view.h"
89
910#include " flutter/flow/layers/layer_tree.h"
1011#include " flutter/flow/layers/transform_layer.h"
1112#include " flutter/fml/make_copyable.h"
1213#include " flutter/fml/mapping.h"
1314#include " flutter/runtime/dart_vm.h"
1415#include " flutter/shell/common/vsync_waiter_fallback.h"
15- #include " flutter/shell/gpu/gpu_surface_gl.h"
1616#include " flutter/testing/testing.h"
1717
1818namespace flutter {
@@ -272,9 +272,9 @@ std::unique_ptr<Shell> ShellTest::CreateShell(Settings settings,
272272 return Shell::Create (
273273 task_runners, settings,
274274 [vsync_clock, &create_vsync_waiter](Shell& shell) {
275- return std::make_unique<ShellTestPlatformView>(
276- shell, shell. GetTaskRunners (), vsync_clock,
277- std::move (create_vsync_waiter));
275+ return ShellTestPlatformView::Create (shell, shell. GetTaskRunners (),
276+ vsync_clock,
277+ std::move (create_vsync_waiter));
278278 },
279279 [](Shell& shell) {
280280 return std::make_unique<Rasterizer>(shell, shell.GetTaskRunners ());
@@ -301,70 +301,5 @@ void ShellTest::AddNativeCallback(std::string name,
301301 native_resolver_->AddNativeCallback (std::move (name), callback);
302302}
303303
304- ShellTestPlatformView::ShellTestPlatformView (
305- PlatformView::Delegate& delegate,
306- TaskRunners task_runners,
307- std::shared_ptr<ShellTestVsyncClock> vsync_clock,
308- CreateVsyncWaiter create_vsync_waiter)
309- : PlatformView(delegate, std::move(task_runners)),
310- gl_surface_(SkISize::Make(800 , 600 )),
311- create_vsync_waiter_(std::move(create_vsync_waiter)),
312- vsync_clock_(vsync_clock) {}
313-
314- ShellTestPlatformView::~ShellTestPlatformView () = default ;
315-
316- std::unique_ptr<VsyncWaiter> ShellTestPlatformView::CreateVSyncWaiter () {
317- return create_vsync_waiter_ ();
318- }
319-
320- void ShellTestPlatformView::SimulateVSync () {
321- vsync_clock_->SimulateVSync ();
322- }
323-
324- // |PlatformView|
325- std::unique_ptr<Surface> ShellTestPlatformView::CreateRenderingSurface () {
326- return std::make_unique<GPUSurfaceGL>(this , true );
327- }
328-
329- // |PlatformView|
330- PointerDataDispatcherMaker ShellTestPlatformView::GetDispatcherMaker () {
331- return [](DefaultPointerDataDispatcher::Delegate& delegate) {
332- return std::make_unique<SmoothPointerDataDispatcher>(delegate);
333- };
334- }
335-
336- // |GPUSurfaceGLDelegate|
337- bool ShellTestPlatformView::GLContextMakeCurrent () {
338- return gl_surface_.MakeCurrent ();
339- }
340-
341- // |GPUSurfaceGLDelegate|
342- bool ShellTestPlatformView::GLContextClearCurrent () {
343- return gl_surface_.ClearCurrent ();
344- }
345-
346- // |GPUSurfaceGLDelegate|
347- bool ShellTestPlatformView::GLContextPresent () {
348- return gl_surface_.Present ();
349- }
350-
351- // |GPUSurfaceGLDelegate|
352- intptr_t ShellTestPlatformView::GLContextFBO () const {
353- return gl_surface_.GetFramebuffer ();
354- }
355-
356- // |GPUSurfaceGLDelegate|
357- GPUSurfaceGLDelegate::GLProcResolver ShellTestPlatformView::GetGLProcResolver ()
358- const {
359- return [surface = &gl_surface_](const char * name) -> void * {
360- return surface->GetProcAddress (name);
361- };
362- }
363-
364- // |GPUSurfaceGLDelegate|
365- ExternalViewEmbedder* ShellTestPlatformView::GetExternalViewEmbedder () {
366- return nullptr ;
367- }
368-
369304} // namespace testing
370305} // namespace flutter
0 commit comments