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

Side by Side Diff: chrome/browser/chromeos/login/saml/saml_browsertest.cc

Issue 1097663003: Fetch OAuth2 tokens prior to profile creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: OAuth2TokenInitializer for non-SAML only Created 5 years, 8 months 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
OLDNEW
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
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"
54 #include "chromeos/settings/cros_settings_names.h" 55 #include "chromeos/settings/cros_settings_names.h"
55 #include "components/policy/core/browser/browser_policy_connector.h" 56 #include "components/policy/core/browser/browser_policy_connector.h"
56 #include "components/policy/core/common/mock_configuration_policy_provider.h" 57 #include "components/policy/core/common/mock_configuration_policy_provider.h"
57 #include "components/policy/core/common/policy_map.h" 58 #include "components/policy/core/common/policy_map.h"
58 #include "components/policy/core/common/policy_switches.h" 59 #include "components/policy/core/common/policy_switches.h"
59 #include "components/policy/core/common/policy_types.h" 60 #include "components/policy/core/common/policy_types.h"
60 #include "components/user_manager/user.h" 61 #include "components/user_manager/user.h"
61 #include "components/user_manager/user_manager.h" 62 #include "components/user_manager/user_manager.h"
62 #include "content/public/browser/browser_thread.h" 63 #include "content/public/browser/browser_thread.h"
63 #include "content/public/browser/render_frame_host.h" 64 #include "content/public/browser/render_frame_host.h"
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 SamlTest::SetUpOnMainThread(); 920 SamlTest::SetUpOnMainThread();
920 921
921 // Pretend that the test users' OAuth tokens are valid. 922 // Pretend that the test users' OAuth tokens are valid.
922 user_manager::UserManager::Get()->SaveUserOAuthStatus( 923 user_manager::UserManager::Get()->SaveUserOAuthStatus(
923 kFirstSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); 924 kFirstSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
924 user_manager::UserManager::Get()->SaveUserOAuthStatus( 925 user_manager::UserManager::Get()->SaveUserOAuthStatus(
925 kNonSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); 926 kNonSAMLUserEmail, user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
926 user_manager::UserManager::Get()->SaveUserOAuthStatus( 927 user_manager::UserManager::Get()->SaveUserOAuthStatus(
927 kDifferentDomainSAMLUserEmail, 928 kDifferentDomainSAMLUserEmail,
928 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); 929 user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
930
931 // Set up fake networks.
932 DBusThreadManager::Get()
933 ->GetShillManagerClient()
934 ->GetTestInterface()
935 ->SetupDefaultEnvironment();
929 } 936 }
930 937
931 void SAMLPolicyTest::SetSAMLOfflineSigninTimeLimitPolicy(int limit) { 938 void SAMLPolicyTest::SetSAMLOfflineSigninTimeLimitPolicy(int limit) {
932 policy::PolicyMap user_policy; 939 policy::PolicyMap user_policy;
933 user_policy.Set(policy::key::kSAMLOfflineSigninTimeLimit, 940 user_policy.Set(policy::key::kSAMLOfflineSigninTimeLimit,
934 policy::POLICY_LEVEL_MANDATORY, 941 policy::POLICY_LEVEL_MANDATORY,
935 policy::POLICY_SCOPE_USER, 942 policy::POLICY_SCOPE_USER,
936 new base::FundamentalValue(limit), 943 new base::FundamentalValue(limit),
937 NULL); 944 NULL);
938 provider_.UpdateChromePolicy(user_policy); 945 provider_.UpdateChromePolicy(user_policy);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); 1171 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName));
1165 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); 1172 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName));
1166 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); 1173 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName));
1167 } 1174 }
1168 1175
1169 INSTANTIATE_TEST_CASE_P(SamlSuite, 1176 INSTANTIATE_TEST_CASE_P(SamlSuite,
1170 SAMLPolicyTest, 1177 SAMLPolicyTest,
1171 testing::Bool()); 1178 testing::Bool());
1172 1179
1173 } // namespace chromeos 1180 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698