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

Side by Side Diff: remoting/host/self_access_verifier_unittest.cc

Issue 8662001: Remove AccessVerifier interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/self_access_verifier.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 "base/memory/ref_counted.h"
6 #include "base/task.h"
7 #include "remoting/host/in_memory_host_config.h"
8 #include "remoting/host/self_access_verifier.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace remoting {
13
14 namespace {
15 const char kTestJid[] = "host@domain.com";
16 } // namespace
17
18 class SelfAccessVerifierTest : public testing::Test {
19 protected:
20 virtual void SetUp() {
21 config_ = new InMemoryHostConfig();
22 }
23
24 void InitConfig() {
25 config_->SetString(kXmppLoginConfigPath, kTestJid);
26 }
27
28 scoped_refptr<InMemoryHostConfig> config_;
29 };
30
31 TEST_F(SelfAccessVerifierTest, InvalidConfig) {
32 SelfAccessVerifier target;
33 EXPECT_FALSE(target.Init(config_));
34 }
35
36 TEST_F(SelfAccessVerifierTest, VerifyPermissions) {
37 SelfAccessVerifier target;
38 InitConfig();
39 ASSERT_TRUE(target.Init(config_));
40 EXPECT_TRUE(target.VerifyPermissions("host@domain.com/123123", ""));
41 EXPECT_TRUE(target.VerifyPermissions("hOsT@domain.com/123123", ""));
42 EXPECT_FALSE(target.VerifyPermissions("host@domain.com", ""));
43 EXPECT_FALSE(target.VerifyPermissions("otherhost@domain.com/123123", ""));
44 EXPECT_FALSE(target.VerifyPermissions("host@otherdomain.com/123123", ""));
45 EXPECT_FALSE(target.VerifyPermissions("", ""));
46 EXPECT_FALSE(target.VerifyPermissions("host@domain.co/saf", ""));
47 EXPECT_FALSE(target.VerifyPermissions("host@domain.com.other/blah", ""));
48
49 // Non ASCII string.
50 EXPECT_FALSE(target.VerifyPermissions("абв@domain.com/saf", ""));
51 }
52
53 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/self_access_verifier.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698