5#include "flutter/shell/platform/common/engine_switches.h"
7#include "gtest/gtest.h"
13void SetEnvironmentVariable(
const char*
key,
const char*
value) {
22void ClearEnvironmentVariable(
const char*
key) {
33 ClearEnvironmentVariable(
"FLUTTER_ENGINE_SWITCHES");
39TEST(FlutterProjectBundle, SwitchesIgnoredInRelease) {
40 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCHES",
"2");
41 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_1",
"abc");
42 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_2",
"foo=\"bar, baz\"");
45 EXPECT_EQ(switches.size(), 0
U);
49#ifndef FLUTTER_RELEASE
51 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCHES",
"2");
52 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_1",
"abc");
53 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_2",
"foo=\"bar, baz\"");
56 EXPECT_EQ(switches.size(), 2U);
57 EXPECT_EQ(switches[0],
"--abc");
58 EXPECT_EQ(switches[1],
"--foo=\"bar, baz\"");
62 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCHES",
"1");
63 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_1",
"abc");
64 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_2",
"foo=\"bar, baz\"");
67 EXPECT_EQ(switches.size(), 1U);
68 EXPECT_EQ(switches[0],
"--abc");
72 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCHES",
"4");
73 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_1",
"abc");
74 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_2",
"foo=\"bar, baz\"");
75 ClearEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_3");
76 SetEnvironmentVariable(
"FLUTTER_ENGINE_SWITCH_4",
"oops");
79 EXPECT_EQ(switches.size(), 3U);
80 EXPECT_EQ(switches[0],
"--abc");
81 EXPECT_EQ(switches[1],
"--foo=\"bar, baz\"");
84 EXPECT_EQ(switches[2],
"--oops");
TEST(FrameTimingsRecorderTest, RecordVsync)
std::vector< std::string > GetSwitchesFromEnvironment()
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size