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 "chrome/browser/chromeos/login/supervised/supervised_user_test_base.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_test_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 // Select the first user as manager, and enter password. | 288 // Select the first user as manager, and enter password. |
289 JSExpect("$('supervised-user-creation-next-button').disabled"); | 289 JSExpect("$('supervised-user-creation-next-button').disabled"); |
290 JSSetTextField("#supervised-user-creation .manager-pod.focused input", | 290 JSSetTextField("#supervised-user-creation .manager-pod.focused input", |
291 kTestManagerPassword); | 291 kTestManagerPassword); |
292 | 292 |
293 JSEval("$('supervised-user-creation').updateNextButtonForManager_()"); | 293 JSEval("$('supervised-user-creation').updateNextButtonForManager_()"); |
294 | 294 |
295 // Next button is now enabled. | 295 // Next button is now enabled. |
296 JSExpect("!$('supervised-user-creation-next-button').disabled"); | 296 JSExpect("!$('supervised-user-creation-next-button').disabled"); |
297 UserContext user_context(kTestManager); | 297 UserContext user_context(AccountId::FromUserEmail(kTestManager)); |
298 user_context.SetGaiaID(GetGaiaIDForUserID(kTestManager)); | 298 user_context.SetGaiaID(GetGaiaIDForUserID(kTestManager)); |
299 user_context.SetKey(Key(kTestManagerPassword)); | 299 user_context.SetKey(Key(kTestManagerPassword)); |
300 SetExpectedCredentials(user_context); | 300 SetExpectedCredentials(user_context); |
301 content::WindowedNotificationObserver login_observer( | 301 content::WindowedNotificationObserver login_observer( |
302 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 302 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
303 content::NotificationService::AllSources()); | 303 content::NotificationService::AllSources()); |
304 | 304 |
305 // Log in as manager. | 305 // Log in as manager. |
306 JSEval("$('supervised-user-creation-next-button').click()"); | 306 JSEval("$('supervised-user-creation-next-button').click()"); |
307 login_observer.Wait(); | 307 login_observer.Wait(); |
308 | 308 |
309 // OAuth token is valid. | 309 // OAuth token is valid. |
310 user_manager::UserManager::Get()->SaveUserOAuthStatus( | 310 user_manager::UserManager::Get()->SaveUserOAuthStatus( |
311 kTestManager, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); | 311 AccountId::FromUserEmail(kTestManager), |
| 312 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
312 base::RunLoop().RunUntilIdle(); | 313 base::RunLoop().RunUntilIdle(); |
313 | 314 |
314 // Check the page have changed. | 315 // Check the page have changed. |
315 JSExpect(StringPrintf("%s == 'username'", kCurrentPage)); | 316 JSExpect(StringPrintf("%s == 'username'", kCurrentPage)); |
316 } | 317 } |
317 | 318 |
318 void SupervisedUserTestBase::FillNewUserData(const std::string& display_name) { | 319 void SupervisedUserTestBase::FillNewUserData(const std::string& display_name) { |
319 JSExpect("$('supervised-user-creation-next-button').disabled"); | 320 JSExpect("$('supervised-user-creation-next-button').disabled"); |
320 JSSetTextField("#supervised-user-creation-name", display_name); | 321 JSSetTextField("#supervised-user-creation-name", display_name); |
321 JSEval("$('supervised-user-creation').checkUserName_()"); | 322 JSEval("$('supervised-user-creation').checkUserName_()"); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 JSEval(StringPrintf( | 440 JSEval(StringPrintf( |
440 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", | 441 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", |
441 user_index)); | 442 user_index)); |
442 | 443 |
443 // Make sure there is no supervised user in list. | 444 // Make sure there is no supervised user in list. |
444 ASSERT_EQ(original_user_count - 1, | 445 ASSERT_EQ(original_user_count - 1, |
445 user_manager::UserManager::Get()->GetUsers().size()); | 446 user_manager::UserManager::Get()->GetUsers().size()); |
446 } | 447 } |
447 | 448 |
448 } // namespace chromeos | 449 } // namespace chromeos |
OLD | NEW |