Index: chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
index 5922fee18dd76ad0adf38f0b9106bfeeae6ed01e..3e9c5d50157260bee7f1f4e69404c482f9f97147 100644 |
--- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
+++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
@@ -1923,6 +1923,25 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, TermsOfServiceWithLocaleSwitch) { |
->GetCurrentInputMethod() |
.id()); |
+ // Wait for 'tos-accept-button' to become enabled. |
+ done = false; |
+ ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
+ contents_, |
+ "var screenElement = document.getElementById('tos-accept-button');" |
+ "function SendReplyIfAcceptEnabled() {" |
+ " if ($('tos-accept-button').disabled)" |
+ " return false;" |
+ " domAutomationController.send(true);" |
+ " observer.disconnect();" |
+ " return true;" |
+ "}" |
+ "var observer = new MutationObserver(SendReplyIfAcceptEnabled);" |
+ "if (!SendReplyIfAcceptEnabled()) {" |
+ " var options = { attributes: true };" |
+ " observer.observe(screenElement, options);" |
+ "}", |
+ &done)); |
+ |
// Click the accept button. |
ASSERT_TRUE(content::ExecuteScript(contents_, |
"$('tos-accept-button').click();")); |