Skip to content

Commit

Permalink
Use macro for google test flags
Browse files Browse the repository at this point in the history
GTest is getting updated and the way how flags are set has also been
changed to be through a macro. This change corrects the remaining
offending code to make use of this macro.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/7f4b01bd3e8e61957bd6a85ee913b924061f5978

commit 7f4b01bd3e8e61957bd6a85ee913b924061f5978
Author: Daniel Cheng <dcheng@chromium.org>
Date:   Sat Feb 24 10:16:02 2024 +0000

    Roll src/third_party/googletest/src/ af29db7ec..76bb2afb8 (375 commits)

    This roll includes several fixes needed to unblock the automated roll.
    In particular, the biggest change is disabling Abseil support in
    GoogleTest: GoogleTest has switched to using Abseil flags when
    GTEST_HAS_ABSL is set, which is incompatible with Chrome. For Chrome,
    the main impact of disabling Abseil support is losing the pretty printer
    for absl::variant; however, Chrome plans to switch to std::variant once
    the codegen issues are fixed.

    Unfortunately, this also requires suppressing GN check for GoogleTest
    to prevent errors from false positives, since GN does not understand
    conditional includes and does not realize that the Abseil flags headers
    are not actually included.

    Created with:
      roll-dep src/third_party/googletest/src

    Bug: 1409870
  • Loading branch information
cdesouza-chromium committed Mar 28, 2024
1 parent 5f2a0bb commit 70e535e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ TEST(MediaYouTubeTest, GetVideoUrl) {
// https://source.chromium.org/chromium/chromium/src/+/master:base/test/gtest_util.h;l=23
// Death tests misbehave on Android.
#if !BUILDFLAG(IS_ANDROID)
::testing::FLAGS_gtest_death_test_style = "threadsafe";
GTEST_FLAG_SET(death_test_style, "threadsafe");
EXPECT_DEATH({ YouTube::GetVideoUrl(media_id); },
"Check failed: !media_id.empty*");
#endif // !BUILDFLAG(IS_ANDROID)
Expand Down Expand Up @@ -469,7 +469,7 @@ TEST(MediaYouTubeTest, GetChannelUrl) {
// https://source.chromium.org/chromium/chromium/src/+/master:base/test/gtest_util.h;l=23
// Death tests misbehave on Android.
#if !BUILDFLAG(IS_ANDROID)
::testing::FLAGS_gtest_death_test_style = "threadsafe";
GTEST_FLAG_SET(death_test_style, "threadsafe");
EXPECT_DEATH({ YouTube::GetChannelUrl(channel_id); },
"Check failed: !publisher_key.empty*");
#endif // !BUILDFLAG(IS_ANDROID)
Expand Down

0 comments on commit 70e535e

Please sign in to comment.