Update SplitString calls to new form
[chromium-blink-merge.git] / remoting / host / pin_hash_unittest.cc
blobcce48e09078c08390297a13c26fddc171c5bc405
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <set>
6 #include <string>
8 #include "remoting/host/pin_hash.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace remoting {
13 class PinHashTest : public testing::Test {
16 TEST_F(PinHashTest, KnownHashValue) {
17 std::string hash = MakeHostPinHash("Host ID", "1234");
18 ASSERT_EQ("hmac:bk6RVRFLpLO89mr4QPHSg8CemUUtI90r2F0VfvTmWLI=", hash);
21 TEST_F(PinHashTest, VerifyHostPinHash) {
22 std::string host_id1("Host ID 1");
23 std::string host_id2("Host ID 2");
24 std::string pin1("1234");
25 std::string pin2("4321");
26 ASSERT_TRUE(VerifyHostPinHash(MakeHostPinHash(host_id1, pin1),
27 host_id1,
28 pin1));
29 ASSERT_FALSE(VerifyHostPinHash(MakeHostPinHash(host_id1, pin1),
30 host_id2,
31 pin1));
32 ASSERT_FALSE(VerifyHostPinHash(MakeHostPinHash(host_id1, pin1),
33 host_id1,
34 pin2));
37 } // namespace remoting