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" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 mock_homedir_methods_ = NULL; | 208 mock_homedir_methods_ = NULL; |
209 mock_async_method_caller_ = NULL; | 209 mock_async_method_caller_ = NULL; |
210 LoginManagerTest::TearDown(); | 210 LoginManagerTest::TearDown(); |
211 } | 211 } |
212 | 212 |
213 void ManagedUserTestBase::TearDownInProcessBrowserTestFixture() { | 213 void ManagedUserTestBase::TearDownInProcessBrowserTestFixture() { |
214 NetworkPortalDetector::Shutdown(); | 214 NetworkPortalDetector::Shutdown(); |
215 } | 215 } |
216 | 216 |
217 void ManagedUserTestBase::JSEval(const std::string& script) { | 217 void ManagedUserTestBase::JSEval(const std::string& script) { |
218 EXPECT_TRUE(content::ExecuteScript(web_contents(), script)); | 218 EXPECT_TRUE(content::ExecuteScript(web_contents(), script)) << script; |
219 } | 219 } |
220 | 220 |
221 void ManagedUserTestBase::JSExpectAsync(const std::string& function) { | 221 void ManagedUserTestBase::JSExpectAsync(const std::string& function) { |
222 bool result; | 222 bool result; |
223 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 223 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
224 web_contents(), | 224 web_contents(), |
225 StringPrintf( | 225 StringPrintf( |
226 "(%s)(function() { window.domAutomationController.send(true); });", | 226 "(%s)(function() { window.domAutomationController.send(true); });", |
227 function.c_str()), | 227 function.c_str()), |
228 &result)); | 228 &result)) << function; |
229 EXPECT_TRUE(result); | 229 EXPECT_TRUE(result); |
230 } | 230 } |
231 | 231 |
232 void ManagedUserTestBase::JSSetTextField(const std::string& element_selector, | 232 void ManagedUserTestBase::JSSetTextField(const std::string& element_selector, |
233 const std::string& value) { | 233 const std::string& value) { |
234 std::string function = | 234 std::string function = |
235 StringPrintf("document.querySelector('%s').value = '%s'", | 235 StringPrintf("document.querySelector('%s').value = '%s'", |
236 element_selector.c_str(), | 236 element_selector.c_str(), |
237 value.c_str()); | 237 value.c_str()); |
238 JSEval(function); | 238 JSEval(function); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // Confirm deletion. | 420 // Confirm deletion. |
421 JSEval(StringPrintf( | 421 JSEval(StringPrintf( |
422 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", | 422 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", |
423 user_index)); | 423 user_index)); |
424 | 424 |
425 // Make sure there is no supervised user in list. | 425 // Make sure there is no supervised user in list. |
426 ASSERT_EQ(original_user_count - 1, UserManager::Get()->GetUsers().size()); | 426 ASSERT_EQ(original_user_count - 1, UserManager::Get()->GetUsers().size()); |
427 } | 427 } |
428 | 428 |
429 } // namespace chromeos | 429 } // namespace chromeos |
OLD | NEW |