mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1275198 - Part 2: Simple test cases. r=francois.
This commit is contained in:
parent
074726d052
commit
c8e28547cf
@ -0,0 +1,24 @@
|
||||
#include "safebrowsing.pb.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(SafeBrowsingProtobuf, 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);
|
||||
}
|
@ -10,6 +10,7 @@ LOCAL_INCLUDES += [
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'TestChunkSet.cpp',
|
||||
'TestSafeBrowsingProtobuf.cpp',
|
||||
'TestUrlClassifierUtils.cpp',
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user