summaryrefslogtreecommitdiff
path: root/cmds/incidentd/tests/Section_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/incidentd/tests/Section_test.cpp')
-rw-r--r--cmds/incidentd/tests/Section_test.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/cmds/incidentd/tests/Section_test.cpp b/cmds/incidentd/tests/Section_test.cpp
index 9b684a060286..24454ed15d40 100644
--- a/cmds/incidentd/tests/Section_test.cpp
+++ b/cmds/incidentd/tests/Section_test.cpp
@@ -82,6 +82,16 @@ protected:
virtual IBinder* onAsBinder() override { return nullptr; };
};
+namespace {
+void getHeaderData(const IncidentHeaderProto& headerProto, vector<uint8_t>* out) {
+ out->clear();
+ auto serialized = headerProto.SerializeAsString();
+ if (serialized.empty()) return;
+ out->resize(serialized.length());
+ std::copy(serialized.begin(), serialized.end(), out->begin());
+}
+}
+
TEST_F(SectionTest, HeaderSection) {
HeaderSection hs;
@@ -94,9 +104,15 @@ TEST_F(SectionTest, HeaderSection) {
head1.set_reason("axe");
head2.set_reason("pup");
- args1.addHeader(head1);
- args1.addHeader(head2);
- args2.addHeader(head2);
+ vector<uint8_t> out;
+ getHeaderData(head1, &out);
+ args1.addHeader(out);
+
+ getHeaderData(head2, &out);
+ args1.addHeader(out);
+
+ getHeaderData(head2, &out);
+ args2.addHeader(out);
requests.add(new ReportRequest(args1, new SimpleListener(), -1));
requests.add(new ReportRequest(args2, new SimpleListener(), tf.fd));