| Flutter Windows Embedder |

dart_project_unittests.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 <memory>
6 #include <string>
7
8 #include "flutter/shell/platform/windows/client_wrapper/include/flutter/dart_project.h"
9 #include "gtest/gtest.h"
10
11 namespace flutter {
12
13 class DartProjectTest : public ::testing::Test {
14 protected:
15 // Wrapper for accessing private icu_data_path.
16 std::wstring GetProjectIcuDataPath(const DartProject& project) {
17 return project.icu_data_path();
18 }
19
20 // Wrapper for accessing private assets_path.
21 std::wstring GetProjectAssetsPath(const DartProject& project) {
22 return project.assets_path();
23 }
24
25 // Wrapper for accessing private aot_library_path_.
26 std::wstring GetProjectAotLibraryPath(const DartProject& project) {
27 return project.aot_library_path();
28 }
29 };
30
31 TEST_F(DartProjectTest, StandardProjectFormat) {
32 DartProject project(L"test");
33 EXPECT_EQ(GetProjectIcuDataPath(project), L"test\\icudtl.dat");
34 EXPECT_EQ(GetProjectAssetsPath(project), L"test\\flutter_assets");
35 EXPECT_EQ(GetProjectAotLibraryPath(project), L"test\\app.so");
36 }
37
38 TEST_F(DartProjectTest, ProjectWithCustomPaths) {
39 DartProject project(L"data\\assets", L"icu\\icudtl.dat", L"lib\\file.so");
40 EXPECT_EQ(GetProjectIcuDataPath(project), L"icu\\icudtl.dat");
41 EXPECT_EQ(GetProjectAssetsPath(project), L"data\\assets");
42 EXPECT_EQ(GetProjectAotLibraryPath(project), L"lib\\file.so");
43 }
44
45 TEST_F(DartProjectTest, DartEntrypointArguments) {
46 DartProject project(L"test");
47
48 std::vector<std::string> test_arguments = {"arg1", "arg2", "arg3"};
49 project.set_dart_entrypoint_arguments(test_arguments);
50
51 auto returned_arguments = project.dart_entrypoint_arguments();
52 EXPECT_EQ(returned_arguments.size(), 3U);
53 EXPECT_EQ(returned_arguments[0], "arg1");
54 EXPECT_EQ(returned_arguments[1], "arg2");
55 EXPECT_EQ(returned_arguments[2], "arg3");
56 }
57
58 } // namespace flutter
flutter::DartProject
Definition: dart_project.h:39
flutter::DartProject::set_dart_entrypoint_arguments
void set_dart_entrypoint_arguments(std::vector< std::string > arguments)
Definition: dart_project.h:89
flutter::DartProject::dart_entrypoint_arguments
const std::vector< std::string > & dart_entrypoint_arguments() const
Definition: dart_project.h:95
flutter::DartProjectTest
Definition: dart_project_unittests.cc:13
flutter::DartProjectTest::GetProjectIcuDataPath
std::wstring GetProjectIcuDataPath(const DartProject &project)
Definition: dart_project_unittests.cc:16
flutter::DartProjectTest::GetProjectAssetsPath
std::wstring GetProjectAssetsPath(const DartProject &project)
Definition: dart_project_unittests.cc:21
flutter::DartProjectTest::GetProjectAotLibraryPath
std::wstring GetProjectAotLibraryPath(const DartProject &project)
Definition: dart_project_unittests.cc:26
dart_project.h
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::TEST_F
TEST_F(DartProjectTest, StandardProjectFormat)
Definition: dart_project_unittests.cc:31