gecko-dev/toolkit/components/url-classifier/tests/gtest/TestSafeBrowsingProtobuf.cpp
Sylvestre Ledru 03fc65347c Bug 1542146 - Apply the change with the option StatementMacros from clang-format-8 r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26280

--HG--
extra : moz-landing-system : lando
2019-04-05 21:42:17 +00:00

24 lines
544 B
C++

#include "safebrowsing.pb.h"
#include "gtest/gtest.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;
r.SerializeToString(&s);
// De-serialize.
FetchThreatListUpdatesRequest r2;
r2.ParseFromString(s);
ASSERT_EQ(r2.client().client_id(), CLIENT_ID);
}