Chromium Code Reviews| Index: remoting/host/setup/pin_validator_unittest.cc |
| diff --git a/remoting/host/setup/pin_validator_unittest.cc b/remoting/host/setup/pin_validator_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a5469ecbfd8b6eaf68b496e0f0be1771a423d7aa |
| --- /dev/null |
| +++ b/remoting/host/setup/pin_validator_unittest.cc |
| @@ -0,0 +1,32 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "remoting/host/setup/pin_validator.h" |
| + |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace remoting { |
| + |
| +TEST(IsPinValidTest, Normal) { |
| + EXPECT_EQ(true, IsPinValid("123456")); |
| +} |
| + |
| +TEST(IsPinValidTest, Short) { |
| + EXPECT_EQ(false, IsPinValid("12345")); |
| +} |
| + |
| +TEST(IsPinValidTest, Long) { |
| + EXPECT_EQ(true, IsPinValid("1234567")); |
| +} |
| + |
| +TEST(IsPinValidTest, BadCharacter) { |
| + EXPECT_EQ(false, IsPinValid("12345/")); |
| + EXPECT_EQ(false, IsPinValid("123456/")); |
| + EXPECT_EQ(false, IsPinValid("/123456")); |
| + EXPECT_EQ(false, IsPinValid("12345:")); |
| + EXPECT_EQ(false, IsPinValid("123456:")); |
| + EXPECT_EQ(false, IsPinValid(":123456")); |
|
Sergey Ulanov
2012/10/11 01:15:24
nit: also try letters, e.g. "a123123"
simonmorris
2012/10/11 21:27:35
Done (though the invalid characters I used are adj
|
| +} |
| + |
| +} // namespace remoting |