| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/policy/device_local_account.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2148 // Spin the loop until the login observer fires. Then, unregister the | 2148 // Spin the loop until the login observer fires. Then, unregister the |
| 2149 // observer. | 2149 // observer. |
| 2150 login_wait_run_loop.Run(); | 2150 login_wait_run_loop.Run(); |
| 2151 controller->set_login_status_consumer(NULL); | 2151 controller->set_login_status_consumer(NULL); |
| 2152 | 2152 |
| 2153 // Verify that the Terms of Service screen is being shown. | 2153 // Verify that the Terms of Service screen is being shown. |
| 2154 chromeos::WizardController* wizard_controller = | 2154 chromeos::WizardController* wizard_controller = |
| 2155 chromeos::WizardController::default_controller(); | 2155 chromeos::WizardController::default_controller(); |
| 2156 ASSERT_TRUE(wizard_controller); | 2156 ASSERT_TRUE(wizard_controller); |
| 2157 ASSERT_TRUE(wizard_controller->current_screen()); | 2157 ASSERT_TRUE(wizard_controller->current_screen()); |
| 2158 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName, | 2158 EXPECT_EQ(chromeos::OobeScreen::SCREEN_TERMS_OF_SERVICE, |
| 2159 wizard_controller->current_screen()->screen_id()); | 2159 wizard_controller->current_screen()->screen_id()); |
| 2160 | 2160 |
| 2161 // Wait for the Terms of Service to finish downloading. | 2161 // Wait for the Terms of Service to finish downloading. |
| 2162 bool done = false; | 2162 bool done = false; |
| 2163 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(contents_, | 2163 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(contents_, |
| 2164 "var screenElement = document.getElementById('terms-of-service');" | 2164 "var screenElement = document.getElementById('terms-of-service');" |
| 2165 "function SendReplyIfDownloadDone() {" | 2165 "function SendReplyIfDownloadDone() {" |
| 2166 " if (screenElement.classList.contains('tos-loading'))" | 2166 " if (screenElement.classList.contains('tos-loading'))" |
| 2167 " return false;" | 2167 " return false;" |
| 2168 " domAutomationController.send(true);" | 2168 " domAutomationController.send(true);" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 ASSERT_TRUE(controller); | 2355 ASSERT_TRUE(controller); |
| 2356 controller->set_login_status_consumer(&login_status_consumer); | 2356 controller->set_login_status_consumer(&login_status_consumer); |
| 2357 login_wait_run_loop.Run(); | 2357 login_wait_run_loop.Run(); |
| 2358 controller->set_login_status_consumer(NULL); | 2358 controller->set_login_status_consumer(NULL); |
| 2359 | 2359 |
| 2360 // Verify that the Terms of Service screen is being shown. | 2360 // Verify that the Terms of Service screen is being shown. |
| 2361 chromeos::WizardController* wizard_controller = | 2361 chromeos::WizardController* wizard_controller = |
| 2362 chromeos::WizardController::default_controller(); | 2362 chromeos::WizardController::default_controller(); |
| 2363 ASSERT_TRUE(wizard_controller); | 2363 ASSERT_TRUE(wizard_controller); |
| 2364 ASSERT_TRUE(wizard_controller->current_screen()); | 2364 ASSERT_TRUE(wizard_controller->current_screen()); |
| 2365 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName, | 2365 EXPECT_EQ(chromeos::OobeScreen::SCREEN_TERMS_OF_SERVICE, |
| 2366 wizard_controller->current_screen()->screen_id()); | 2366 wizard_controller->current_screen()->screen_id()); |
| 2367 | 2367 |
| 2368 // Wait for the Terms of Service to finish downloading, then get the status of | 2368 // Wait for the Terms of Service to finish downloading, then get the status of |
| 2369 // the screen's UI elements. | 2369 // the screen's UI elements. |
| 2370 std::string json; | 2370 std::string json; |
| 2371 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents_, | 2371 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents_, |
| 2372 "var screenElement = document.getElementById('terms-of-service');" | 2372 "var screenElement = document.getElementById('terms-of-service');" |
| 2373 "function SendReplyIfDownloadDone() {" | 2373 "function SendReplyIfDownloadDone() {" |
| 2374 " if (screenElement.classList.contains('tos-loading'))" | 2374 " if (screenElement.classList.contains('tos-loading'))" |
| 2375 " return false;" | 2375 " return false;" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 ASSERT_TRUE(content::ExecuteScript(contents_, | 2448 ASSERT_TRUE(content::ExecuteScript(contents_, |
| 2449 "$('tos-accept-button').click();")); | 2449 "$('tos-accept-button').click();")); |
| 2450 | 2450 |
| 2451 WaitForSessionStart(); | 2451 WaitForSessionStart(); |
| 2452 } | 2452 } |
| 2453 | 2453 |
| 2454 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2454 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
| 2455 TermsOfServiceDownloadTest, testing::Bool()); | 2455 TermsOfServiceDownloadTest, testing::Bool()); |
| 2456 | 2456 |
| 2457 } // namespace policy | 2457 } // namespace policy |
| OLD | NEW |