| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/ref_counted.h" | 5 #include "base/ref_counted.h" |
| 6 #include "base/task.h" | 6 #include "base/task.h" |
| 7 #include "remoting/host/access_verifier.h" | 7 #include "remoting/host/access_verifier.h" |
| 8 #include "remoting/host/in_memory_host_config.h" | 8 #include "remoting/host/in_memory_host_config.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 TEST_F(AccessVerifierTest, InvalidConfig) { | 31 TEST_F(AccessVerifierTest, InvalidConfig) { |
| 32 AccessVerifier target; | 32 AccessVerifier target; |
| 33 EXPECT_FALSE(target.Init(config_)); | 33 EXPECT_FALSE(target.Init(config_)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 TEST_F(AccessVerifierTest, VerifyPermissions) { | 36 TEST_F(AccessVerifierTest, VerifyPermissions) { |
| 37 AccessVerifier target; | 37 AccessVerifier target; |
| 38 InitConfig(); | 38 InitConfig(); |
| 39 ASSERT_TRUE(target.Init(config_)); | 39 ASSERT_TRUE(target.Init(config_)); |
| 40 EXPECT_TRUE(target.VerifyPermissions("host@domain.com/123123", "")); | 40 EXPECT_TRUE(target.VerifyPermissions("host@domain.com/123123", "")); |
| 41 EXPECT_TRUE(target.VerifyPermissions("hOsT@domain.com/123123", "")); |
| 41 EXPECT_FALSE(target.VerifyPermissions("host@domain.com", "")); | 42 EXPECT_FALSE(target.VerifyPermissions("host@domain.com", "")); |
| 42 EXPECT_FALSE(target.VerifyPermissions("otherhost@domain.com/123123", "")); | 43 EXPECT_FALSE(target.VerifyPermissions("otherhost@domain.com/123123", "")); |
| 43 EXPECT_FALSE(target.VerifyPermissions("host@otherdomain.com/123123", "")); | 44 EXPECT_FALSE(target.VerifyPermissions("host@otherdomain.com/123123", "")); |
| 44 EXPECT_FALSE(target.VerifyPermissions("", "")); | 45 EXPECT_FALSE(target.VerifyPermissions("", "")); |
| 45 EXPECT_FALSE(target.VerifyPermissions("host@domain.co/saf", "")); | 46 EXPECT_FALSE(target.VerifyPermissions("host@domain.co/saf", "")); |
| 46 EXPECT_FALSE(target.VerifyPermissions("host@domain.com.other/blah", "")); | 47 EXPECT_FALSE(target.VerifyPermissions("host@domain.com.other/blah", "")); |
| 48 |
| 49 // Non ASCII string. |
| 50 EXPECT_FALSE(target.VerifyPermissions("абв@domain.com/saf", "")); |
| 47 } | 51 } |
| 48 | 52 |
| 49 } // namespace remoting | 53 } // namespace remoting |
| OLD | NEW |