Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
windows_test_context.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/windows/testing/windows_test_context.h"
6
7#include "flutter/fml/platform/win/wstring_conversion.h"
8
9namespace flutter {
10namespace testing {
11
12WindowsTestContext::WindowsTestContext(std::string_view assets_path)
13 : assets_path_(fml::Utf8ToWideString(assets_path)),
14 native_resolver_(std::make_shared<TestDartNativeResolver>()) {
15 isolate_create_callbacks_.push_back(
16 [weak_resolver =
17 std::weak_ptr<TestDartNativeResolver>{native_resolver_}]() {
18 if (auto resolver = weak_resolver.lock()) {
19 resolver->SetNativeResolverForIsolate();
20 }
21 });
22}
23
25
26const std::wstring& WindowsTestContext::GetAssetsPath() const {
27 return assets_path_;
28}
29
30const std::wstring& WindowsTestContext::GetIcuDataPath() const {
31 return icu_data_path_;
32}
33
34const std::wstring& WindowsTestContext::GetAotLibraryPath() const {
35 return aot_library_path_;
36}
37
40 native_resolver_->AddNativeCallback(std::string{name}, function);
41}
42
44 return [this]() {
45 for (auto closure : this->isolate_create_callbacks_) {
46 closure();
47 }
48 };
49}
50
51} // namespace testing
52} // namespace flutter
const std::wstring & GetIcuDataPath() const
void AddNativeFunction(std::string_view name, Dart_NativeFunction function)
const std::wstring & GetAssetsPath() const
const std::wstring & GetAotLibraryPath() const
WindowsTestContext(std::string_view assets_path="")
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
Definition dart_api.h:3198
Dart_NativeFunction function
Definition fuchsia.cc:51
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32
std::function< void()> closure
Definition closure.h:14
Definition ref_ptr.h:256