From 3f950cc9d3d4ecf3a30040034c0dc2a75dd0e5dd Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Tue, 21 Nov 2023 12:25:08 -0800 Subject: [PATCH 1/7] Try rolling a new version of googletest (2021->2023). --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 0732fe1e87b63..3face4b39442e 100644 --- a/DEPS +++ b/DEPS @@ -303,7 +303,7 @@ deps = { Var('chromium_git') + '/external/github.com/google/benchmark' + '@' + '431abd149fd76a072f821913c0340137cc755f36', 'src/third_party/googletest': - Var('chromium_git') + '/external/github.com/google/googletest' + '@' + '054a986a8513149e8374fc669a5fe40117ca6b41', + Var('chromium_git') + '/external/github.com/google/googletest' + '@' + '7f036c5563af7d0329f20e8bb42effb04629f0c0', 'src/third_party/boringssl': Var('dart_git') + '/boringssl_gen.git' + '@' + Var('dart_boringssl_gen_rev'), From 56d04461a43927265343c9f5bf9deedec3beacfa Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Tue, 21 Nov 2023 12:52:50 -0800 Subject: [PATCH 2/7] ++ --- .../secondary/third_party/googletest/BUILD.gn | 41 +++---------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/build/secondary/third_party/googletest/BUILD.gn b/build/secondary/third_party/googletest/BUILD.gn index 72f87cc4749e9..a9bfc960a50b9 100644 --- a/build/secondary/third_party/googletest/BUILD.gn +++ b/build/secondary/third_party/googletest/BUILD.gn @@ -21,41 +21,12 @@ static_library("gtest") { "googletest/include/gtest/gtest-spi.h", "googletest/include/gtest/gtest.h", ] - sources = [ - "googletest/include/gtest/gtest-death-test.h", - "googletest/include/gtest/gtest-message.h", - "googletest/include/gtest/gtest-param-test.h", - "googletest/include/gtest/gtest-printers.h", - "googletest/include/gtest/gtest-test-part.h", - "googletest/include/gtest/gtest-typed-test.h", - "googletest/include/gtest/gtest_pred_impl.h", - "googletest/include/gtest/gtest_prod.h", - "googletest/include/gtest/internal/custom/gtest-port.h", - "googletest/include/gtest/internal/custom/gtest-printers.h", - "googletest/include/gtest/internal/custom/gtest.h", - "googletest/include/gtest/internal/gtest-death-test-internal.h", - "googletest/include/gtest/internal/gtest-filepath.h", - "googletest/include/gtest/internal/gtest-internal.h", - "googletest/include/gtest/internal/gtest-linked_ptr.h", - "googletest/include/gtest/internal/gtest-param-util-generated.h", - "googletest/include/gtest/internal/gtest-param-util.h", - "googletest/include/gtest/internal/gtest-port-arch.h", - "googletest/include/gtest/internal/gtest-port.h", - "googletest/include/gtest/internal/gtest-string.h", - "googletest/include/gtest/internal/gtest-tuple.h", - "googletest/include/gtest/internal/gtest-type-util.h", - "googletest/src/gtest-all.cc", - "googletest/src/gtest-death-test.cc", - "googletest/src/gtest-filepath.cc", - "googletest/src/gtest-internal-inl.h", - "googletest/src/gtest-matchers.cc", - "googletest/src/gtest-port.cc", - "googletest/src/gtest-printers.cc", - "googletest/src/gtest-test-part.cc", - "googletest/src/gtest-typed-test.cc", - "googletest/src/gtest.cc", - ] - sources -= [ "googletest/src/gtest-all.cc" ] + + # Only add the "*-all.cc" files (and no headers) to improve maintainability + # from upstream refactoring. The "*-all.cc" files include the respective + # source files. + sources = [ "googletest/src/gtest-all.cc" ] + public_configs = [ ":gtest_config" ] configs += [ ":gtest_private_config" ] From 0af08c0a0039aa8421b738bf7ba3d068e3fe2ba8 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Tue, 21 Nov 2023 13:19:07 -0800 Subject: [PATCH 3/7] Update static_library(gmock). --- .../secondary/third_party/googletest/BUILD.gn | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/build/secondary/third_party/googletest/BUILD.gn b/build/secondary/third_party/googletest/BUILD.gn index a9bfc960a50b9..93e54a7fd2a2e 100644 --- a/build/secondary/third_party/googletest/BUILD.gn +++ b/build/secondary/third_party/googletest/BUILD.gn @@ -188,31 +188,7 @@ config("gmock_config") { static_library("gmock") { testonly = true public = [ "googlemock/include/gmock/gmock.h" ] - sources = [ - "googlemock/include/gmock/gmock-actions.h", - "googlemock/include/gmock/gmock-cardinalities.h", - "googlemock/include/gmock/gmock-generated-actions.h", - "googlemock/include/gmock/gmock-generated-function-mockers.h", - "googlemock/include/gmock/gmock-generated-matchers.h", - "googlemock/include/gmock/gmock-generated-nice-strict.h", - "googlemock/include/gmock/gmock-matchers.h", - "googlemock/include/gmock/gmock-more-actions.h", - "googlemock/include/gmock/gmock-more-matchers.h", - "googlemock/include/gmock/gmock-spec-builders.h", - "googlemock/include/gmock/internal/custom/gmock-generated-actions.h", - "googlemock/include/gmock/internal/custom/gmock-matchers.h", - "googlemock/include/gmock/internal/custom/gmock-port.h", - "googlemock/include/gmock/internal/gmock-generated-internal-utils.h", - "googlemock/include/gmock/internal/gmock-internal-utils.h", - "googlemock/include/gmock/internal/gmock-port.h", - "googlemock/src/gmock-all.cc", - "googlemock/src/gmock-cardinalities.cc", - "googlemock/src/gmock-internal-utils.cc", - "googlemock/src/gmock-matchers.cc", - "googlemock/src/gmock-spec-builders.cc", - "googlemock/src/gmock.cc", - ] - sources -= [ "googlemock/src/gmock-all.cc" ] + sources = [ "googlemock/src/gmock-all.cc" ] public_configs = [ ":gmock_config" ] configs += [ ":gmock_private_config" ] deps = [ ":gtest" ] From f0716f3a1a8541e33b0ff7a6ce3e2b53880c69cd Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 30 Nov 2023 12:38:29 -0800 Subject: [PATCH 4/7] Wrap operators into the namespace of their arguments. --- .../tests/fakes/scenic/fake_flatland_types.h | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h index 531c709f0183e..a3af751044793 100644 --- a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h +++ b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h @@ -25,6 +25,9 @@ #include "flutter/fml/macros.h" +namespace fuchsia { +namespace math { + inline bool operator==(const fuchsia::math::SizeU& a, const fuchsia::math::SizeU& b) { return a.width == b.width && a.height == b.height; @@ -56,6 +59,20 @@ inline bool operator==(const fuchsia::math::RectF& a, return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; } +inline bool operator==(const std::optional& a, + const std::optional& b) { + if (a.has_value() != b.has_value()) { + return false; + } + if (!a.has_value()) { + } + return a.value() == b.value(); +} + +} // namespace math + +namespace composition { + inline bool operator==(const fuchsia::ui::composition::ContentId& a, const fuchsia::ui::composition::ContentId& b) { return a.value == b.value; @@ -125,15 +142,8 @@ inline bool operator==( return true; } -inline bool operator==(const std::optional& a, - const std::optional& b) { - if (a.has_value() != b.has_value()) { - return false; - } - if (!a.has_value()) { - } - return a.value() == b.value(); -} +} // namespace composition +} // namespace fuchsia namespace flutter_runner::testing { From 73a08eb1ef31856cb3606be2d896e2f158ea1055 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 30 Nov 2023 13:23:49 -0800 Subject: [PATCH 5/7] Maybe also namespace the FakeView:: methods? --- .../flutter/tests/fakes/scenic/fake_flatland_types.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc index 777344a36f5df..4a1fda3bb2be4 100644 --- a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc +++ b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc @@ -109,6 +109,10 @@ BufferCollectionTokenPair BufferCollectionTokenPair::New() { return token_pair; } +} // namespace flutter_runner::testing + +namespace fuchsia::math { + bool FakeView::operator==(const FakeView& other) const { return view_token == other.view_token && view_ref == other.view_ref && view_ref_control == other.view_ref_control && @@ -177,4 +181,4 @@ FakeGraph FakeGraph::Clone() const { return clone; } -} // namespace flutter_runner::testing +} // namespace fuchsia::math From add389e77dfa93fdfad8e360e21ff7e5b0518ca7 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 30 Nov 2023 13:25:55 -0800 Subject: [PATCH 6/7] Add a missing namespace. --- .../fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h index a3af751044793..c03b903c228e1 100644 --- a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h +++ b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h @@ -71,7 +71,7 @@ inline bool operator==(const std::optional& a, } // namespace math -namespace composition { +namespace ui::composition { inline bool operator==(const fuchsia::ui::composition::ContentId& a, const fuchsia::ui::composition::ContentId& b) { @@ -142,7 +142,7 @@ inline bool operator==( return true; } -} // namespace composition +} // namespace ui::composition } // namespace fuchsia namespace flutter_runner::testing { From cee3467f9f82244a4bb156dd424832d250b47488 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 30 Nov 2023 13:26:20 -0800 Subject: [PATCH 7/7] Revert previous change. --- .../flutter/tests/fakes/scenic/fake_flatland_types.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc index 4a1fda3bb2be4..777344a36f5df 100644 --- a/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc +++ b/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc @@ -109,10 +109,6 @@ BufferCollectionTokenPair BufferCollectionTokenPair::New() { return token_pair; } -} // namespace flutter_runner::testing - -namespace fuchsia::math { - bool FakeView::operator==(const FakeView& other) const { return view_token == other.view_token && view_ref == other.view_ref && view_ref_control == other.view_ref_control && @@ -181,4 +177,4 @@ FakeGraph FakeGraph::Clone() const { return clone; } -} // namespace fuchsia::math +} // namespace flutter_runner::testing