Files
sousa-gecko/toolkit/components/url-classifier/tests/gtest/TestSafeBrowsingProtobuf.cpp
T
Ryan VanderMeulen 47fd6ce131 Bug 1989886 - Update protobuf to v35.0. r=firefox-build-system-reviewers,timhuang,sergesanspaille
- Re-vendored protobuf at v35.0 alongside third_party/utf8_range, a
  build-time dependency pulled in by extension_set_inl.h. Expanded
  moz.yaml excludes to cover the reorganized upstream layout (json/,
  util/, bridge/, compiler/, plus test/build-config files leaked past
  the default exclude pattern), and dropped the now-upstreamed
  remove_iostream_header.patch.
- Added /third_party/abseil-cpp to chromium-config.mozbuild's
  LOCAL_INCLUDES so transitive absl/* includes resolve in every
  protobuf consumer that includes chromium-config; added direct
  LOCAL_INCLUDES on the few that don't.
- Added a pragma to abseil's check_op.h to suppress sign-compare in
  CHECK_OP macros, scoping the suppression to translation units that
  include this header rather than globally.
- Added USE_LIBS += ["abseil"] to the content_analysis_sdk_agent
  Program() so it can link absl symbols.
- Audited moz.build SOURCES and EXPORTS against actual usage and
  removed full-runtime files (well-known type .pb.cc/.pb.h,
  reflection_ops, dynamic_message, text_format, descriptor, etc.)
  that our lite-mode generated code doesn't reach.
- Taught generate_files.py to update gradle/libs.versions.toml's
  `protobuf` (Java/Maven) value to match the vendored C++ revision
  on future re-vendors.
- Suppressed nodiscard warnings on pre-existing SerializeToString
  calls in url-classifier with (void) casts.

Differential Revision: https://phabricator.services.mozilla.com/D300213
2026-05-20 20:19:02 +00:00

30 lines
758 B
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "safebrowsing.pb.h"
#include "Common.h"
TEST(UrlClassifierProtobuf, Empty)
{
using namespace mozilla::safebrowsing;
const std::string CLIENT_ID = "firefox";
// Construct a simple update request.
FetchThreatListUpdatesRequest r;
r.set_allocated_client(new ClientInfo());
r.mutable_client()->set_client_id(CLIENT_ID);
// Then serialize.
std::string s;
(void)r.SerializeToString(&s);
// De-serialize.
FetchThreatListUpdatesRequest r2;
(void)r2.ParseFromString(s);
ASSERT_EQ(r2.client().client_id(), CLIENT_ID);
}