Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: components/cryptauth/wire_message_unittest.cc

Issue 2561203002: Migrate weave-related classes from proximity_auth/ble to cryptauth/ble. (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/cryptauth/wire_message.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace proximity_auth { 12 namespace cryptauth {
13 13
14 TEST(ProximityAuthWireMessage, Deserialize_EmptyMessage) { 14 TEST(ProximityAuthWireMessage, Deserialize_EmptyMessage) {
15 bool is_incomplete; 15 bool is_incomplete;
16 std::unique_ptr<WireMessage> message = 16 std::unique_ptr<WireMessage> message =
17 WireMessage::Deserialize(std::string(), &is_incomplete); 17 WireMessage::Deserialize(std::string(), &is_incomplete);
18 EXPECT_TRUE(is_incomplete); 18 EXPECT_TRUE(is_incomplete);
19 EXPECT_FALSE(message); 19 EXPECT_FALSE(message);
20 } 20 }
21 21
22 TEST(ProximityAuthWireMessage, Deserialize_IncompleteHeader) { 22 TEST(ProximityAuthWireMessage, Deserialize_IncompleteHeader) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 EXPECT_EQ(std::string(), message2->permit_id()); 228 EXPECT_EQ(std::string(), message2->permit_id());
229 EXPECT_EQ("example payload", message2->payload()); 229 EXPECT_EQ("example payload", message2->payload());
230 } 230 }
231 231
232 TEST(ProximityAuthWireMessage, Serialize_FailsWithoutPayload) { 232 TEST(ProximityAuthWireMessage, Serialize_FailsWithoutPayload) {
233 WireMessage message1(std::string(), "example id"); 233 WireMessage message1(std::string(), "example id");
234 std::string bytes = message1.Serialize(); 234 std::string bytes = message1.Serialize();
235 EXPECT_TRUE(bytes.empty()); 235 EXPECT_TRUE(bytes.empty());
236 } 236 }
237 237
238 } // namespace proximity_auth 238 } // namespace cryptauth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698