Home | History | Annotate | Download | only in setup
      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.
      4 
      5 #include "remoting/host/setup/pin_validator.h"
      6 
      7 #include "testing/gtest/include/gtest/gtest.h"
      8 
      9 namespace remoting {
     10 
     11 TEST(IsPinValidTest, Normal) {
     12   EXPECT_TRUE(IsPinValid("123456"));
     13 }
     14 
     15 TEST(IsPinValidTest, Short) {
     16   EXPECT_FALSE(IsPinValid("12345"));
     17 }
     18 
     19 TEST(IsPinValidTest, Long) {
     20   EXPECT_TRUE(IsPinValid("1234567"));
     21 }
     22 
     23 TEST(IsPinValidTest, BadCharacter) {
     24   EXPECT_FALSE(IsPinValid("12345/"));
     25   EXPECT_FALSE(IsPinValid("123456/"));
     26   EXPECT_FALSE(IsPinValid("/123456"));
     27   EXPECT_FALSE(IsPinValid("12345:"));
     28   EXPECT_FALSE(IsPinValid("123456:"));
     29   EXPECT_FALSE(IsPinValid(":123456"));
     30   EXPECT_FALSE(IsPinValid("12345a"));
     31   EXPECT_FALSE(IsPinValid("123456a"));
     32   EXPECT_FALSE(IsPinValid("a123456"));
     33 }
     34 
     35 }  // namespace remoting
     36