| 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/managed/managed_user_test_base.h" | 5 #include "chrome/browser/chromeos/login/managed/managed_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" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/chromeos/login/auth/key.h" |
| 17 #include "chrome/browser/chromeos/login/auth/user_context.h" |
| 16 #include "chrome/browser/chromeos/login/login_manager_test.h" | 18 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 17 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" | 19 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" |
| 18 #include "chrome/browser/chromeos/login/startup_utils.h" | 20 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 19 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 21 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 20 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 22 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 21 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 23 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 22 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 24 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 23 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 25 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| 24 #include "chrome/browser/managed_mode/managed_user_constants.h" | 26 #include "chrome/browser/managed_mode/managed_user_constants.h" |
| 25 #include "chrome/browser/managed_mode/managed_user_registration_utility.h" | 27 #include "chrome/browser/managed_mode/managed_user_registration_utility.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 282 |
| 281 // Select the first user as manager, and enter password. | 283 // Select the first user as manager, and enter password. |
| 282 JSExpect("$('managed-user-creation-next-button').disabled"); | 284 JSExpect("$('managed-user-creation-next-button').disabled"); |
| 283 JSSetTextField("#managed-user-creation .manager-pod.focused input", | 285 JSSetTextField("#managed-user-creation .manager-pod.focused input", |
| 284 kTestManagerPassword); | 286 kTestManagerPassword); |
| 285 | 287 |
| 286 JSEval("$('managed-user-creation').updateNextButtonForManager_()"); | 288 JSEval("$('managed-user-creation').updateNextButtonForManager_()"); |
| 287 | 289 |
| 288 // Next button is now enabled. | 290 // Next button is now enabled. |
| 289 JSExpect("!$('managed-user-creation-next-button').disabled"); | 291 JSExpect("!$('managed-user-creation-next-button').disabled"); |
| 290 SetExpectedCredentials(kTestManager, kTestManagerPassword); | 292 UserContext user_context(kTestManager); |
| 293 user_context.SetKey(Key(kTestManagerPassword)); |
| 294 SetExpectedCredentials(user_context); |
| 291 content::WindowedNotificationObserver login_observer( | 295 content::WindowedNotificationObserver login_observer( |
| 292 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 296 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 293 content::NotificationService::AllSources()); | 297 content::NotificationService::AllSources()); |
| 294 | 298 |
| 295 // Log in as manager. | 299 // Log in as manager. |
| 296 JSEval("$('managed-user-creation-next-button').click()"); | 300 JSEval("$('managed-user-creation-next-button').click()"); |
| 297 login_observer.Wait(); | 301 login_observer.Wait(); |
| 298 | 302 |
| 299 // OAuth token is valid. | 303 // OAuth token is valid. |
| 300 UserManager::Get()->SaveUserOAuthStatus(kTestManager, | 304 UserManager::Get()->SaveUserOAuthStatus(kTestManager, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Confirm deletion. | 424 // Confirm deletion. |
| 421 JSEval(StringPrintf( | 425 JSEval(StringPrintf( |
| 422 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", | 426 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", |
| 423 user_index)); | 427 user_index)); |
| 424 | 428 |
| 425 // Make sure there is no supervised user in list. | 429 // Make sure there is no supervised user in list. |
| 426 ASSERT_EQ(original_user_count - 1, UserManager::Get()->GetUsers().size()); | 430 ASSERT_EQ(original_user_count - 1, UserManager::Get()->GetUsers().size()); |
| 427 } | 431 } |
| 428 | 432 |
| 429 } // namespace chromeos | 433 } // namespace chromeos |
| OLD | NEW |