Flutter Engine
runner_unittest.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 <gtest/gtest.h>
6 #include <cstdlib>
7 
8 #include "runner.h"
9 #include "third_party/icu/source/i18n/unicode/timezone.h"
10 
11 namespace flutter_runner {
12 
13 TEST(RunnerTest, TZData) {
14  // TODO(fxbug.dev/69570): Move to cml file if env_vars gains supported for the
15  // gtest_runner.
16  setenv("ICU_TIMEZONE_FILES_DIR", "/pkg/data/tzdata", true);
17 
18  UErrorCode err = U_ZERO_ERROR;
19  const auto version_before = std::string(icu::TimeZone::getTZDataVersion(err));
20  ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
21 
22  // This loads the tzdata. In Fuchsia, we force the data from this package
23  // to be version 2019a, so that we can test the resource load.
24  bool success = Runner::SetupICUInternal();
25  ASSERT_TRUE(success) << "failed to load timezone data";
26 
27  const auto version_after = std::string(icu::TimeZone::getTZDataVersion(err));
28  ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
29 
30  EXPECT_EQ("2019a", version_after);
31 }
32 
33 } // namespace flutter_runner
TEST(RunnerTZDataTest, LoadsWithoutTZDataPresent)