/src/mozilla-central/toolkit/components/url-classifier/tests/gtest/TestSafeBrowsingProtobuf.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | #include "safebrowsing.pb.h" |
2 | | #include "gtest/gtest.h" |
3 | | |
4 | | TEST(UrlClassifierProtobuf, Empty) |
5 | 0 | { |
6 | 0 | using namespace mozilla::safebrowsing; |
7 | 0 |
|
8 | 0 | const std::string CLIENT_ID = "firefox"; |
9 | 0 |
|
10 | 0 | // Construct a simple update request. |
11 | 0 | FetchThreatListUpdatesRequest r; |
12 | 0 | r.set_allocated_client(new ClientInfo()); |
13 | 0 | r.mutable_client()->set_client_id(CLIENT_ID); |
14 | 0 |
|
15 | 0 | // Then serialize. |
16 | 0 | std::string s; |
17 | 0 | r.SerializeToString(&s); |
18 | 0 |
|
19 | 0 | // De-serialize. |
20 | 0 | FetchThreatListUpdatesRequest r2; |
21 | 0 | r2.ParseFromString(s); |
22 | 0 |
|
23 | 0 | ASSERT_EQ(r2.client().client_id(), CLIENT_ID); |
24 | 0 | } |