| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 void RunUntilIdle() { | 132 void RunUntilIdle() { |
| 133 base::RunLoop().RunUntilIdle(); | 133 base::RunLoop().RunUntilIdle(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector() { | 136 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector() { |
| 137 return g_browser_process->platform_part() | 137 return g_browser_process->platform_part() |
| 138 ->browser_policy_connector_chromeos(); | 138 ->browser_policy_connector_chromeos(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void EnrollDevice(const std::string& username) { | 141 void EnrollDevice(const std::string& domain) { |
| 142 base::RunLoop loop; | 142 base::RunLoop loop; |
| 143 InstallAttributes::LockResult result; | 143 InstallAttributes::LockResult result; |
| 144 browser_policy_connector()->GetInstallAttributes()->LockDevice( | 144 browser_policy_connector()->GetInstallAttributes()->LockDevice( |
| 145 username, policy::DEVICE_MODE_ENTERPRISE, "100200300", | 145 policy::DEVICE_MODE_ENTERPRISE, domain, std::string(), "100200300", |
| 146 base::Bind(&CopyLockResult, &loop, &result)); | 146 base::Bind(&CopyLockResult, &loop, &result)); |
| 147 loop.Run(); | 147 loop.Run(); |
| 148 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS, result); | 148 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS, result); |
| 149 RunUntilIdle(); | 149 RunUntilIdle(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void Login(const std::string& username) { | 152 void Login(const std::string& username) { |
| 153 content::WindowedNotificationObserver session_started_observer( | 153 content::WindowedNotificationObserver session_started_observer( |
| 154 chrome::NOTIFICATION_SESSION_STARTED, | 154 chrome::NOTIFICATION_SESSION_STARTED, |
| 155 content::NotificationService::AllSources()); | 155 content::NotificationService::AllSources()); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 IN_PROC_BROWSER_TEST_P(BlockingLoginTest, LoginBlocksForUser) { | 243 IN_PROC_BROWSER_TEST_P(BlockingLoginTest, LoginBlocksForUser) { |
| 244 // Verify that there isn't a logged in user when the test starts. | 244 // Verify that there isn't a logged in user when the test starts. |
| 245 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 245 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 246 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 246 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
| 247 EXPECT_FALSE(browser_policy_connector()->IsEnterpriseManaged()); | 247 EXPECT_FALSE(browser_policy_connector()->IsEnterpriseManaged()); |
| 248 EXPECT_FALSE(profile_added_); | 248 EXPECT_FALSE(profile_added_); |
| 249 | 249 |
| 250 // Enroll the device, if enrollment is enabled for this test instance. | 250 // Enroll the device, if enrollment is enabled for this test instance. |
| 251 if (GetParam().enroll_device) { | 251 if (GetParam().enroll_device) { |
| 252 EnrollDevice(kUsername); | 252 EnrollDevice(kDomain); |
| 253 | 253 |
| 254 EXPECT_FALSE(user_manager->IsUserLoggedIn()); | 254 EXPECT_FALSE(user_manager->IsUserLoggedIn()); |
| 255 EXPECT_TRUE(browser_policy_connector()->IsEnterpriseManaged()); | 255 EXPECT_TRUE(browser_policy_connector()->IsEnterpriseManaged()); |
| 256 EXPECT_EQ(kDomain, browser_policy_connector()->GetEnterpriseDomain()); | 256 EXPECT_EQ(kDomain, browser_policy_connector()->GetEnterpriseDomain()); |
| 257 EXPECT_FALSE(profile_added_); | 257 EXPECT_FALSE(profile_added_); |
| 258 RunUntilIdle(); | 258 RunUntilIdle(); |
| 259 EXPECT_FALSE( | 259 EXPECT_FALSE( |
| 260 user_manager->IsKnownUser(AccountId::FromUserEmail(kUsername))); | 260 user_manager->IsKnownUser(AccountId::FromUserEmail(kUsername))); |
| 261 } | 261 } |
| 262 | 262 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 {3, kUsernameOtherDomain, true}, | 331 {3, kUsernameOtherDomain, true}, |
| 332 {4, kUsernameOtherDomain, true}, | 332 {4, kUsernameOtherDomain, true}, |
| 333 {5, kUsernameOtherDomain, true}, | 333 {5, kUsernameOtherDomain, true}, |
| 334 }; | 334 }; |
| 335 | 335 |
| 336 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, | 336 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, |
| 337 BlockingLoginTest, | 337 BlockingLoginTest, |
| 338 testing::ValuesIn(kBlockinLoginTestCases)); | 338 testing::ValuesIn(kBlockinLoginTestCases)); |
| 339 | 339 |
| 340 } // namespace chromeos | 340 } // namespace chromeos |
| OLD | NEW |