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#ifndef FLUTTER_TESTING_DART_FIXTURE_H_
6#define FLUTTER_TESTING_DART_FIXTURE_H_
7
8#include <memory>
9
10#include "flutter/common/settings.h"
11#include "flutter/runtime/dart_vm.h"
12#include "flutter/testing/elf_loader.h"
13#include "flutter/testing/test_dart_native_resolver.h"
14#include "flutter/testing/testing.h"
15#include "flutter/testing/thread_test.h"
16
17namespace flutter::testing {
18
19class DartFixture {
20 public:
21 // Uses the default filenames from the fixtures generator.
22 DartFixture();
23
24 // Allows to customize the kernel, ELF and split ELF filenames.
25 DartFixture(std::string kernel_filename,
26 std::string elf_filename,
27 std::string elf_split_filename);
28
29 virtual Settings CreateSettingsForFixture();
30
31 void AddNativeCallback(const std::string& name, Dart_NativeFunction callback);
32 void AddFfiNativeCallback(const std::string& name, void* callback_ptr);
33
34 protected:
35 void SetSnapshotsAndAssets(Settings& settings);
36
37 std::shared_ptr<TestDartNativeResolver> native_resolver_;
38 ELFAOTSymbols split_aot_symbols_;
39 std::string kernel_filename_;
40 std::string elf_filename_;
41 fml::UniqueFD assets_dir_;
42 ELFAOTSymbols aot_symbols_;
43
44 private:
45 FML_DISALLOW_COPY_AND_ASSIGN(DartFixture);
46};
47
48} // namespace flutter::testing
49
50#endif // FLUTTER_TESTING_DART_FIXTURE_H_
51

source code of flutter_engine/flutter/testing/dart_fixture.h