Flutter Engine
embedder_test_context_software.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "flutter/shell/platform/embedder/tests/embedder_test_context_software.h"
6 
7 #include "flutter/fml/make_copyable.h"
8 #include "flutter/fml/paths.h"
9 #include "flutter/runtime/dart_vm.h"
10 #include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
11 #include "flutter/shell/platform/embedder/tests/embedder_test_compositor_software.h"
12 #include "flutter/testing/testing.h"
13 #include "third_party/dart/runtime/bin/elf_loader.h"
14 #include "third_party/skia/include/core/SkSurface.h"
15 
16 namespace flutter {
17 namespace testing {
18 
20  std::string assets_path)
21  : EmbedderTestContext(assets_path) {}
22 
24 
25 bool EmbedderTestContextSoftware::Present(sk_sp<SkImage> image) {
26  software_surface_present_count_++;
27 
28  FireRootSurfacePresentCallbackIfPresent([image] { return image; });
29 
30  return true;
31 }
32 
34  return software_surface_present_count_;
35 }
36 
37 void EmbedderTestContextSoftware::SetupSurface(SkISize surface_size) {
38  surface_size_ = surface_size;
39 }
40 
42  FML_CHECK(!compositor_) << "Already setup a compositor in this context.";
43  compositor_ = std::make_unique<EmbedderTestCompositorSoftware>(surface_size_);
44 }
45 
46 } // namespace testing
47 } // namespace flutter
void FireRootSurfacePresentCallbackIfPresent(const std::function< sk_sp< SkImage >(void)> &image_callback)
std::unique_ptr< EmbedderTestCompositor > compositor_
#define FML_CHECK(condition)
Definition: logging.h:68