|
5 | 5 | #define FML_USED_ON_EMBEDDER |
6 | 6 |
|
7 | 7 | #include "flutter/shell/common/shell_test.h" |
| 8 | +#include "flutter/shell/common/shell_test_platform_view.h" |
8 | 9 |
|
9 | 10 | #include "flutter/flow/layers/layer_tree.h" |
10 | 11 | #include "flutter/flow/layers/transform_layer.h" |
11 | 12 | #include "flutter/fml/make_copyable.h" |
12 | 13 | #include "flutter/fml/mapping.h" |
13 | 14 | #include "flutter/runtime/dart_vm.h" |
14 | 15 | #include "flutter/shell/common/vsync_waiter_fallback.h" |
15 | | -#include "flutter/shell/gpu/gpu_surface_gl.h" |
16 | 16 | #include "flutter/testing/testing.h" |
17 | 17 |
|
18 | 18 | namespace flutter { |
@@ -272,7 +272,7 @@ std::unique_ptr<Shell> ShellTest::CreateShell(Settings settings, |
272 | 272 | return Shell::Create( |
273 | 273 | task_runners, settings, |
274 | 274 | [vsync_clock, &create_vsync_waiter](Shell& shell) { |
275 | | - return std::make_unique<ShellTestPlatformView>( |
| 275 | + return ShellTestPlatformView::Create( |
276 | 276 | shell, shell.GetTaskRunners(), vsync_clock, |
277 | 277 | std::move(create_vsync_waiter)); |
278 | 278 | }, |
@@ -301,70 +301,5 @@ void ShellTest::AddNativeCallback(std::string name, |
301 | 301 | native_resolver_->AddNativeCallback(std::move(name), callback); |
302 | 302 | } |
303 | 303 |
|
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 | | - |
369 | 304 | } // namespace testing |
370 | 305 | } // namespace flutter |
0 commit comments