• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 "components/policy/core/browser/browser_policy_connector.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7 
8 namespace policy {
9 
TEST(BrowserPolicyConnectorTest,IsNonEnterpriseUser)10 TEST(BrowserPolicyConnectorTest, IsNonEnterpriseUser) {
11   // List of example emails that are not enterprise users.
12   static const char* kNonEnterpriseUsers[] = {
13     "fizz@aol.com",
14     "foo@gmail.com",
15     "bar@googlemail.com",
16     "baz@hotmail.it",
17     "baz@hotmail.co.uk",
18     "baz@hotmail.com.tw",
19     "user@msn.com",
20     "another_user@live.com",
21     "foo@qq.com",
22     "i_love@yahoo.com",
23     "i_love@yahoo.com.tw",
24     "i_love@yahoo.jp",
25     "i_love@yahoo.co.uk",
26     "user@yandex.ru"
27   };
28 
29   // List of example emails that are potential enterprise users.
30   static const char* kEnterpriseUsers[] = {
31     "foo@google.com",
32     "chrome_rules@chromium.org",
33     "user@hotmail.enterprise.com",
34   };
35 
36   for (unsigned int i = 0; i < arraysize(kNonEnterpriseUsers); ++i) {
37     std::string username(kNonEnterpriseUsers[i]);
38     EXPECT_TRUE(BrowserPolicyConnector::IsNonEnterpriseUser(username)) <<
39         "IsNonEnterpriseUser returned false for " << username;
40   }
41   for (unsigned int i = 0; i < arraysize(kEnterpriseUsers); ++i) {
42     std::string username(kEnterpriseUsers[i]);
43     EXPECT_FALSE(BrowserPolicyConnector::IsNonEnterpriseUser(username)) <<
44         "IsNonEnterpriseUser returned true for " << username;
45   }
46 }
47 
48 }  // namespace policy
49