OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 <cstring> | 5 #include <cstring> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/common/chrome_paths.h" | 44 #include "chrome/common/chrome_paths.h" |
45 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
46 #include "chrome/common/extensions/features/feature_channel.h" | 46 #include "chrome/common/extensions/features/feature_channel.h" |
47 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
48 #include "chrome/grit/generated_resources.h" | 48 #include "chrome/grit/generated_resources.h" |
49 #include "chrome/test/base/in_process_browser_test.h" | 49 #include "chrome/test/base/in_process_browser_test.h" |
50 #include "chromeos/chromeos_switches.h" | 50 #include "chromeos/chromeos_switches.h" |
51 #include "chromeos/dbus/dbus_thread_manager.h" | 51 #include "chromeos/dbus/dbus_thread_manager.h" |
52 #include "chromeos/dbus/fake_session_manager_client.h" | 52 #include "chromeos/dbus/fake_session_manager_client.h" |
53 #include "chromeos/dbus/session_manager_client.h" | 53 #include "chromeos/dbus/session_manager_client.h" |
54 #include "chromeos/dbus/shill_manager_client.h" | |
55 #include "chromeos/settings/cros_settings_names.h" | 54 #include "chromeos/settings/cros_settings_names.h" |
56 #include "components/policy/core/browser/browser_policy_connector.h" | 55 #include "components/policy/core/browser/browser_policy_connector.h" |
57 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 56 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
58 #include "components/policy/core/common/policy_map.h" | 57 #include "components/policy/core/common/policy_map.h" |
59 #include "components/policy/core/common/policy_switches.h" | 58 #include "components/policy/core/common/policy_switches.h" |
60 #include "components/policy/core/common/policy_types.h" | 59 #include "components/policy/core/common/policy_types.h" |
61 #include "components/user_manager/user.h" | 60 #include "components/user_manager/user.h" |
62 #include "components/user_manager/user_manager.h" | 61 #include "components/user_manager/user_manager.h" |
63 #include "content/public/browser/browser_thread.h" | 62 #include "content/public/browser/browser_thread.h" |
64 #include "content/public/browser/render_frame_host.h" | 63 #include "content/public/browser/render_frame_host.h" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 SamlTest::SetUpOnMainThread(); | 866 SamlTest::SetUpOnMainThread(); |
868 | 867 |
869 // Pretend that the test users' OAuth tokens are valid. | 868 // Pretend that the test users' OAuth tokens are valid. |
870 user_manager::UserManager::Get()->SaveUserOAuthStatus( | 869 user_manager::UserManager::Get()->SaveUserOAuthStatus( |
871 kFirstSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); | 870 kFirstSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
872 user_manager::UserManager::Get()->SaveUserOAuthStatus( | 871 user_manager::UserManager::Get()->SaveUserOAuthStatus( |
873 kNonSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); | 872 kNonSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
874 user_manager::UserManager::Get()->SaveUserOAuthStatus( | 873 user_manager::UserManager::Get()->SaveUserOAuthStatus( |
875 kDifferentDomainSAMLUserEmail, | 874 kDifferentDomainSAMLUserEmail, |
876 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); | 875 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
877 | |
878 // Set up fake networks. | |
879 DBusThreadManager::Get() | |
880 ->GetShillManagerClient() | |
881 ->GetTestInterface() | |
882 ->SetupDefaultEnvironment(); | |
883 } | 876 } |
884 | 877 |
885 void SAMLPolicyTest::SetSAMLOfflineSigninTimeLimitPolicy(int limit) { | 878 void SAMLPolicyTest::SetSAMLOfflineSigninTimeLimitPolicy(int limit) { |
886 policy::PolicyMap user_policy; | 879 policy::PolicyMap user_policy; |
887 user_policy.Set(policy::key::kSAMLOfflineSigninTimeLimit, | 880 user_policy.Set(policy::key::kSAMLOfflineSigninTimeLimit, |
888 policy::POLICY_LEVEL_MANDATORY, | 881 policy::POLICY_LEVEL_MANDATORY, |
889 policy::POLICY_SCOPE_USER, | 882 policy::POLICY_SCOPE_USER, |
890 new base::FundamentalValue(limit), | 883 new base::FundamentalValue(limit), |
891 NULL); | 884 NULL); |
892 provider_.UpdateChromePolicy(user_policy); | 885 provider_.UpdateChromePolicy(user_policy); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); | 1111 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); |
1119 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); | 1112 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); |
1120 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); | 1113 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); |
1121 } | 1114 } |
1122 | 1115 |
1123 INSTANTIATE_TEST_CASE_P(SamlSuite, | 1116 INSTANTIATE_TEST_CASE_P(SamlSuite, |
1124 SAMLPolicyTest, | 1117 SAMLPolicyTest, |
1125 testing::Bool()); | 1118 testing::Bool()); |
1126 | 1119 |
1127 } // namespace chromeos | 1120 } // namespace chromeos |
OLD | NEW |