| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 6 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 7 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.
h" | 7 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.
h" |
| 8 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_
impl.h" | 8 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_
impl.h" |
| 9 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_
mock.h" | 9 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_
mock.h" |
| 10 #include "chrome/browser/chromeos/login/login_manager_test.h" | 10 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 DBusThreadManager::Get()->GetAuthPolicyClient()) | 159 DBusThreadManager::Get()->GetAuthPolicyClient()) |
| 160 ->set_operation_delay(base::TimeDelta::FromSeconds(0)); | 160 ->set_operation_delay(base::TimeDelta::FromSeconds(0)); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void SetupActiveDirectoryJSNotifications() { | 163 void SetupActiveDirectoryJSNotifications() { |
| 164 js_checker().ExecuteAsync( | 164 js_checker().ExecuteAsync( |
| 165 "var testShowStep = login.OAuthEnrollmentScreen.showStep;" | 165 "var testShowStep = login.OAuthEnrollmentScreen.showStep;" |
| 166 "login.OAuthEnrollmentScreen.showStep = function(step) {" | 166 "login.OAuthEnrollmentScreen.showStep = function(step) {" |
| 167 " testShowStep(step);" | 167 " testShowStep(step);" |
| 168 " if (step == 'working') {" | 168 " if (step == 'working') {" |
| 169 " window.domAutomationController.setAutomationId(0);" | |
| 170 " window.domAutomationController.send('ShowSpinnerScreen');" | 169 " window.domAutomationController.send('ShowSpinnerScreen');" |
| 171 " }" | 170 " }" |
| 172 "}"); | 171 "}"); |
| 173 js_checker().ExecuteAsync( | 172 js_checker().ExecuteAsync( |
| 174 "var testInvalidateAd = login.OAuthEnrollmentScreen.invalidateAd;" | 173 "var testInvalidateAd = login.OAuthEnrollmentScreen.invalidateAd;" |
| 175 "login.OAuthEnrollmentScreen.invalidateAd = function(machineName, " | 174 "login.OAuthEnrollmentScreen.invalidateAd = function(machineName, " |
| 176 "user, errorState) {" | 175 "user, errorState) {" |
| 177 " testInvalidateAd(machineName, user, errorState);" | 176 " testInvalidateAd(machineName, user, errorState);" |
| 178 " window.domAutomationController.setAutomationId(0);" | |
| 179 " window.domAutomationController.send('ShowJoinDomainError');" | 177 " window.domAutomationController.send('ShowJoinDomainError');" |
| 180 "}"); | 178 "}"); |
| 181 } | 179 } |
| 182 | 180 |
| 183 void WaitForMessage(content::DOMMessageQueue* message_queue, | 181 void WaitForMessage(content::DOMMessageQueue* message_queue, |
| 184 const std::string& expected_message) { | 182 const std::string& expected_message) { |
| 185 std::string message; | 183 std::string message; |
| 186 do { | 184 do { |
| 187 ASSERT_TRUE(message_queue->WaitForMessage(&message)); | 185 ASSERT_TRUE(message_queue->WaitForMessage(&message)); |
| 188 } while (message != expected_message); | 186 } while (message != expected_message); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 EXPECT_TRUE(IsStepDisplayed("ad-join")); | 383 EXPECT_TRUE(IsStepDisplayed("ad-join")); |
| 386 js_checker().ExpectFalse(std::string(kAdMachineNameInput) + ".isInvalid"); | 384 js_checker().ExpectFalse(std::string(kAdMachineNameInput) + ".isInvalid"); |
| 387 js_checker().ExpectTrue(std::string(kAdUsernameInput) + ".isInvalid"); | 385 js_checker().ExpectTrue(std::string(kAdUsernameInput) + ".isInvalid"); |
| 388 js_checker().ExpectFalse(std::string(kAdPasswordInput) + ".isInvalid"); | 386 js_checker().ExpectFalse(std::string(kAdPasswordInput) + ".isInvalid"); |
| 389 | 387 |
| 390 // We have to remove the enrollment_helper before the dtor gets called. | 388 // We have to remove the enrollment_helper before the dtor gets called. |
| 391 enrollment_screen()->enrollment_helper_.reset(); | 389 enrollment_screen()->enrollment_helper_.reset(); |
| 392 } | 390 } |
| 393 | 391 |
| 394 } // namespace chromeos | 392 } // namespace chromeos |
| OLD | NEW |