OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/proximity_auth/wire_message.h" | 5 #include "components/proximity_auth/wire_message.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
9 | 11 |
10 namespace proximity_auth { | 12 namespace proximity_auth { |
11 | 13 |
12 TEST(ProximityAuthWireMessage, Deserialize_EmptyMessage) { | 14 TEST(ProximityAuthWireMessage, Deserialize_EmptyMessage) { |
13 bool is_incomplete; | 15 bool is_incomplete; |
14 scoped_ptr<WireMessage> message = | 16 scoped_ptr<WireMessage> message = |
15 WireMessage::Deserialize(std::string(), &is_incomplete); | 17 WireMessage::Deserialize(std::string(), &is_incomplete); |
16 EXPECT_TRUE(is_incomplete); | 18 EXPECT_TRUE(is_incomplete); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 EXPECT_EQ("example payload", message2->payload()); | 229 EXPECT_EQ("example payload", message2->payload()); |
228 } | 230 } |
229 | 231 |
230 TEST(ProximityAuthWireMessage, Serialize_FailsWithoutPayload) { | 232 TEST(ProximityAuthWireMessage, Serialize_FailsWithoutPayload) { |
231 WireMessage message1(std::string(), "example id"); | 233 WireMessage message1(std::string(), "example id"); |
232 std::string bytes = message1.Serialize(); | 234 std::string bytes = message1.Serialize(); |
233 EXPECT_TRUE(bytes.empty()); | 235 EXPECT_TRUE(bytes.empty()); |
234 } | 236 } |
235 | 237 |
236 } // namespace proximity_auth | 238 } // namespace proximity_auth |
OLD | NEW |