Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_browsertest.cc

Issue 426063005: Allow recommended locales to be set for public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
pneubeck (no reviews) 2014/07/30 17:55:44 How about breaking this into several files accordi
bartfab (slow) 2014/08/05 17:16:23 Good idea. I filed crbug.com/400702 against myself
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 #include <vector>
7 8
8 #include "apps/app_window_registry.h" 9 #include "apps/app_window_registry.h"
9 #include "apps/ui/native_app_window.h" 10 #include "apps/ui/native_app_window.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/system/chromeos/session/logout_confirmation_controller.h" 12 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
12 #include "ash/system/chromeos/session/logout_confirmation_dialog.h" 13 #include "ash/system/chromeos/session/logout_confirmation_dialog.h"
13 #include "base/basictypes.h" 14 #include "base/basictypes.h"
14 #include "base/bind.h" 15 #include "base/bind.h"
15 #include "base/bind_helpers.h" 16 #include "base/bind_helpers.h"
16 #include "base/callback.h" 17 #include "base/callback.h"
(...skipping 15 matching lines...) Expand all
32 #include "base/sequenced_task_runner.h" 33 #include "base/sequenced_task_runner.h"
33 #include "base/strings/string_number_conversions.h" 34 #include "base/strings/string_number_conversions.h"
34 #include "base/strings/string_util.h" 35 #include "base/strings/string_util.h"
35 #include "base/strings/stringprintf.h" 36 #include "base/strings/stringprintf.h"
36 #include "base/strings/utf_string_conversions.h" 37 #include "base/strings/utf_string_conversions.h"
37 #include "base/values.h" 38 #include "base/values.h"
38 #include "chrome/browser/browser_process.h" 39 #include "chrome/browser/browser_process.h"
39 #include "chrome/browser/chrome_notification_types.h" 40 #include "chrome/browser/chrome_notification_types.h"
40 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic y_loader.h" 41 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic y_loader.h"
41 #include "chrome/browser/chromeos/extensions/external_cache.h" 42 #include "chrome/browser/chromeos/extensions/external_cache.h"
43 #include "chrome/browser/chromeos/input_method/input_method_util.h"
42 #include "chrome/browser/chromeos/login/existing_user_controller.h" 44 #include "chrome/browser/chromeos/login/existing_user_controller.h"
43 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" 45 #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
44 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 46 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
45 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 47 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
46 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 48 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
47 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" 49 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h"
48 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" 50 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h"
49 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_test_uti l.h" 51 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_test_uti l.h"
50 #include "chrome/browser/chromeos/login/users/user_manager.h" 52 #include "chrome/browser/chromeos/login/users/user_manager.h"
51 #include "chrome/browser/chromeos/login/users/user_manager_impl.h" 53 #include "chrome/browser/chromeos/login/users/user_manager_impl.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #include "components/policy/core/common/cloud/cloud_policy_store.h" 94 #include "components/policy/core/common/cloud/cloud_policy_store.h"
93 #include "components/policy/core/common/cloud/policy_builder.h" 95 #include "components/policy/core/common/cloud/policy_builder.h"
94 #include "components/policy/core/common/external_data_fetcher.h" 96 #include "components/policy/core/common/external_data_fetcher.h"
95 #include "components/policy/core/common/policy_map.h" 97 #include "components/policy/core/common/policy_map.h"
96 #include "components/policy/core/common/policy_namespace.h" 98 #include "components/policy/core/common/policy_namespace.h"
97 #include "components/policy/core/common/policy_service.h" 99 #include "components/policy/core/common/policy_service.h"
98 #include "components/policy/core/common/policy_switches.h" 100 #include "components/policy/core/common/policy_switches.h"
99 #include "components/signin/core/common/signin_pref_names.h" 101 #include "components/signin/core/common/signin_pref_names.h"
100 #include "components/user_manager/user.h" 102 #include "components/user_manager/user.h"
101 #include "components/user_manager/user_type.h" 103 #include "components/user_manager/user_type.h"
104 #include "content/public/browser/browser_thread.h"
102 #include "content/public/browser/notification_details.h" 105 #include "content/public/browser/notification_details.h"
103 #include "content/public/browser/notification_service.h" 106 #include "content/public/browser/notification_service.h"
104 #include "content/public/browser/notification_source.h" 107 #include "content/public/browser/notification_source.h"
105 #include "content/public/browser/web_contents.h" 108 #include "content/public/browser/web_contents.h"
106 #include "content/public/browser/web_ui.h" 109 #include "content/public/browser/web_ui.h"
107 #include "content/public/test/browser_test_utils.h" 110 #include "content/public/test/browser_test_utils.h"
108 #include "content/public/test/test_utils.h" 111 #include "content/public/test/test_utils.h"
109 #include "crypto/rsa_private_key.h" 112 #include "crypto/rsa_private_key.h"
110 #include "extensions/browser/extension_system.h" 113 #include "extensions/browser/extension_system.h"
111 #include "extensions/browser/management_policy.h" 114 #include "extensions/browser/management_policy.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 const char kHostedAppCRXPath[] = "extensions/hosted_app.crx"; 168 const char kHostedAppCRXPath[] = "extensions/hosted_app.crx";
166 const char kHostedAppVersion[] = "1.0.0.0"; 169 const char kHostedAppVersion[] = "1.0.0.0";
167 const char kGoodExtensionID[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; 170 const char kGoodExtensionID[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
168 const char kGoodExtensionCRXPath[] = "extensions/good.crx"; 171 const char kGoodExtensionCRXPath[] = "extensions/good.crx";
169 const char kGoodExtensionVersion[] = "1.0"; 172 const char kGoodExtensionVersion[] = "1.0";
170 const char kPackagedAppCRXPath[] = "extensions/platform_apps/app_window_2.crx"; 173 const char kPackagedAppCRXPath[] = "extensions/platform_apps/app_window_2.crx";
171 174
172 const char kExternalData[] = "External data"; 175 const char kExternalData[] = "External data";
173 const char kExternalDataURL[] = "http://localhost/external_data"; 176 const char kExternalDataURL[] = "http://localhost/external_data";
174 177
178 const char* kRecommendedLocales1[] = {
179 "pl",
180 "et",
181 "en-US",
182 };
183 const char* kRecommendedLocales2[] = {
184 "fr",
185 "nl",
186 };
175 const char kPublicSessionLocale[] = "de"; 187 const char kPublicSessionLocale[] = "de";
176 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; 188 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger";
177 189
178 // Helper that serves extension update manifests to Chrome. 190 // Helper that serves extension update manifests to Chrome.
179 class TestingUpdateManifestProvider { 191 class TestingUpdateManifestProvider {
180 public: 192 public:
181 // Update manifests will be served at |relative_update_url|. 193 // Update manifests will be served at |relative_update_url|.
182 explicit TestingUpdateManifestProvider( 194 explicit TestingUpdateManifestProvider(
183 const std::string& relative_update_url); 195 const std::string& relative_update_url);
184 ~TestingUpdateManifestProvider(); 196 ~TestingUpdateManifestProvider();
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 em::DeviceLocalAccountInfoProto* account = 496 em::DeviceLocalAccountInfoProto* account =
485 proto.mutable_device_local_accounts()->add_account(); 497 proto.mutable_device_local_accounts()->add_account();
486 account->set_account_id(username); 498 account->set_account_id(username);
487 account->set_type( 499 account->set_type(
488 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_PUBLIC_SESSION); 500 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_PUBLIC_SESSION);
489 RefreshDevicePolicy(); 501 RefreshDevicePolicy();
490 test_server_.UpdatePolicy(dm_protocol::kChromeDevicePolicyType, 502 test_server_.UpdatePolicy(dm_protocol::kChromeDevicePolicyType,
491 std::string(), proto.SerializeAsString()); 503 std::string(), proto.SerializeAsString());
492 } 504 }
493 505
506 void EnableAutoLogin() {
507 em::ChromeDeviceSettingsProto& proto(device_policy()->payload());
508 em::DeviceLocalAccountsProto* device_local_accounts =
509 proto.mutable_device_local_accounts();
510 device_local_accounts->set_auto_login_id(kAccountId1);
511 device_local_accounts->set_auto_login_delay(0);
512 RefreshDevicePolicy();
513 test_server_.UpdatePolicy(dm_protocol::kChromeDevicePolicyType,
514 std::string(), proto.SerializeAsString());
515 }
516
494 void CheckPublicSessionPresent(const std::string& id) { 517 void CheckPublicSessionPresent(const std::string& id) {
495 const user_manager::User* user = chromeos::UserManager::Get()->FindUser(id); 518 const user_manager::User* user = chromeos::UserManager::Get()->FindUser(id);
496 ASSERT_TRUE(user); 519 ASSERT_TRUE(user);
497 EXPECT_EQ(id, user->email()); 520 EXPECT_EQ(id, user->email());
498 EXPECT_EQ(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user->GetType()); 521 EXPECT_EQ(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user->GetType());
499 } 522 }
500 523
501 base::FilePath GetExtensionCacheDirectoryForAccountID( 524 base::FilePath GetExtensionCacheDirectoryForAccountID(
502 const std::string& account_id) { 525 const std::string& account_id) {
503 base::FilePath extension_cache_root_dir; 526 base::FilePath extension_cache_root_dir;
(...skipping 11 matching lines...) Expand all
515 return GetExtensionCacheDirectoryForAccountID(account_id) 538 return GetExtensionCacheDirectoryForAccountID(account_id)
516 .Append(base::StringPrintf("%s-%s.crx", id.c_str(), version.c_str())); 539 .Append(base::StringPrintf("%s-%s.crx", id.c_str(), version.c_str()));
517 } 540 }
518 541
519 // Returns a profile which can be used for testing. 542 // Returns a profile which can be used for testing.
520 Profile* GetProfileForTest() { 543 Profile* GetProfileForTest() {
521 // Any profile can be used here since this test does not test multi profile. 544 // Any profile can be used here since this test does not test multi profile.
522 return ProfileManager::GetActiveUserProfile(); 545 return ProfileManager::GetActiveUserProfile();
523 } 546 }
524 547
548 content::WebContents* GetWebContents() {
549 chromeos::LoginDisplayHostImpl* host =
550 reinterpret_cast<chromeos::LoginDisplayHostImpl*>(
551 chromeos::LoginDisplayHostImpl::default_host());
552 if (!host)
553 return NULL;
554 chromeos::WebUILoginView* web_ui_login_view = host->GetWebUILoginView();
555 if (!web_ui_login_view)
556 return NULL;
557 content::WebUI* web_ui = web_ui_login_view->GetWebUI();
558 if (!web_ui)
559 return NULL;
560 return web_ui->GetWebContents();
561 }
562
525 void WaitForDisplayName(const std::string& user_id, 563 void WaitForDisplayName(const std::string& user_id,
526 const std::string& expected_display_name) { 564 const std::string& expected_display_name) {
527 DictionaryPrefValueWaiter("UserDisplayName", 565 DictionaryPrefValueWaiter("UserDisplayName",
528 user_id, 566 user_id,
529 expected_display_name).Wait(); 567 expected_display_name).Wait();
530 } 568 }
531 569
532 void WaitForPolicy() { 570 void WaitForPolicy() {
533 // Wait for the display name becoming available as that indicates 571 // Wait for the display name becoming available as that indicates
534 // device-local account policy is fully loaded, which is a prerequisite for 572 // device-local account policy is fully loaded, which is a prerequisite for
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 controller->LoginAsPublicSession(user_context); 607 controller->LoginAsPublicSession(user_context);
570 } 608 }
571 609
572 void WaitForSessionStart() { 610 void WaitForSessionStart() {
573 if (IsSessionStarted()) 611 if (IsSessionStarted())
574 return; 612 return;
575 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, 613 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED,
576 base::Bind(IsSessionStarted)).Wait(); 614 base::Bind(IsSessionStarted)).Wait();
577 } 615 }
578 616
617 void SkipToLoginScreen() {
618 chromeos::WizardController* wizard_controller =
619 chromeos::WizardController::default_controller();
620 ASSERT_TRUE(wizard_controller);
pneubeck (no reviews) 2014/07/30 15:23:19 just FYI: ASSERTs in functions only skip the rest
bartfab (slow) 2014/08/05 17:16:23 That's why I use ASSERT_NO_FATAL_FAILURE().
621 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
622 content::WindowedNotificationObserver(
623 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
624 content::NotificationService::AllSources()).Wait();
625 }
626
627 void VerifyKeyboardLayoutMatchesLocale() {
628 chromeos::input_method::InputMethodManager* input_method_manager =
629 chromeos::input_method::InputMethodManager::Get();
630 std::vector<std::string> layouts_from_locale;
631 input_method_manager->GetInputMethodUtil()->
pneubeck (no reviews) 2014/07/30 17:55:44 I don't know how the logic for selecting the keybo
bartfab (slow) 2014/08/05 17:16:24 This is exactly the production function that the U
632 GetInputMethodIdsFromLanguageCode(
633 g_browser_process->GetApplicationLocale(),
634 chromeos::input_method::kKeyboardLayoutsOnly,
635 &layouts_from_locale);
636 ASSERT_FALSE(layouts_from_locale.empty());
637 EXPECT_EQ(layouts_from_locale.front(),
638 input_method_manager->GetCurrentInputMethod().id());
639 }
640
579 const std::string user_id_1_; 641 const std::string user_id_1_;
580 const std::string user_id_2_; 642 const std::string user_id_2_;
581 const std::string public_session_input_method_id_; 643 const std::string public_session_input_method_id_;
582 644
583 scoped_ptr<base::RunLoop> run_loop_; 645 scoped_ptr<base::RunLoop> run_loop_;
584 646
585 UserPolicyBuilder device_local_account_policy_; 647 UserPolicyBuilder device_local_account_policy_;
586 LocalPolicyTestServer test_server_; 648 LocalPolicyTestServer test_server_;
587 649
588 private: 650 private:
(...skipping 15 matching lines...) Expand all
604 666
605 CheckPublicSessionPresent(user_id_1_); 667 CheckPublicSessionPresent(user_id_1_);
606 CheckPublicSessionPresent(user_id_2_); 668 CheckPublicSessionPresent(user_id_2_);
607 } 669 }
608 670
609 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, DisplayName) { 671 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, DisplayName) {
610 UploadAndInstallDeviceLocalAccountPolicy(); 672 UploadAndInstallDeviceLocalAccountPolicy();
611 AddPublicSessionToDevicePolicy(kAccountId1); 673 AddPublicSessionToDevicePolicy(kAccountId1);
612 674
613 WaitForPolicy(); 675 WaitForPolicy();
614 676 ASSERT_NO_FATAL_FAILURE(SkipToLoginScreen());
615 // Skip to the login screen.
616 chromeos::WizardController* wizard_controller =
617 chromeos::WizardController::default_controller();
618 ASSERT_TRUE(wizard_controller);
619 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
620 content::WindowedNotificationObserver(
621 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
622 content::NotificationService::AllSources()).Wait();
623 677
624 // Verify that the display name is shown in the UI. 678 // Verify that the display name is shown in the UI.
625 chromeos::LoginDisplayHostImpl* host = 679 content::WebContents* contents = GetWebContents();
626 reinterpret_cast<chromeos::LoginDisplayHostImpl*>(
627 chromeos::LoginDisplayHostImpl::default_host());
628 ASSERT_TRUE(host);
629 chromeos::WebUILoginView* web_ui_login_view = host->GetWebUILoginView();
630 ASSERT_TRUE(web_ui_login_view);
631 content::WebUI* web_ui = web_ui_login_view->GetWebUI();
632 ASSERT_TRUE(web_ui);
633 content::WebContents* contents = web_ui->GetWebContents();
634 ASSERT_TRUE(contents); 680 ASSERT_TRUE(contents);
635 const std::string get_compact_pod_display_name = base::StringPrintf( 681 const std::string get_compact_pod_display_name = base::StringPrintf(
636 "domAutomationController.send(document.getElementById('pod-row')" 682 "domAutomationController.send(document.getElementById('pod-row')"
637 " .getPodWithUsername_('%s').nameElement.textContent);", 683 " .getPodWithUsername_('%s').nameElement.textContent);",
638 user_id_1_.c_str()); 684 user_id_1_.c_str());
639 std::string display_name; 685 std::string display_name;
640 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 686 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
641 contents, 687 contents,
642 get_compact_pod_display_name, 688 get_compact_pod_display_name,
643 &display_name)); 689 &display_name));
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 ASSERT_TRUE(dialog); 1334 ASSERT_TRUE(dialog);
1289 1335
1290 // Deny the logout. 1336 // Deny the logout.
1291 dialog->GetWidget()->Close(); 1337 dialog->GetWidget()->Close();
1292 dialog = NULL; 1338 dialog = NULL;
1293 base::RunLoop().RunUntilIdle(); 1339 base::RunLoop().RunUntilIdle();
1294 1340
1295 app_window_registry->RemoveObserver(this); 1341 app_window_registry->RemoveObserver(this);
1296 }; 1342 };
1297 1343
1298 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, DoNotSelectLanguageAndKeyboard) { 1344 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, NoRecommendedLocale) {
pneubeck (no reviews) 2014/07/30 15:39:23 is this case different from no locale policy being
bartfab (slow) 2014/08/05 17:16:24 There was no test verifying that scenario. I added
1299 chromeos::input_method::InputMethodManager* input_method_manager =
1300 chromeos::input_method::InputMethodManager::Get();
1301 const std::string initial_locale = g_browser_process->GetApplicationLocale(); 1345 const std::string initial_locale = g_browser_process->GetApplicationLocale();
1302 const std::string initial_input_method =
1303 input_method_manager->GetCurrentInputMethod().id();
1304 1346
1305 UploadAndInstallDeviceLocalAccountPolicy(); 1347 UploadAndInstallDeviceLocalAccountPolicy();
1306 AddPublicSessionToDevicePolicy(kAccountId1); 1348 AddPublicSessionToDevicePolicy(kAccountId1);
1307 1349
1308 WaitForPolicy(); 1350 WaitForPolicy();
1309 ASSERT_NO_FATAL_FAILURE(WaitForLoginUI()); 1351 ASSERT_NO_FATAL_FAILURE(SkipToLoginScreen());
1310 ASSERT_NO_FATAL_FAILURE(StartLogin(std::string(), std::string())); 1352
1353 // Click on the pod to expand it. Verify that the pod expands to its basic
1354 // form as there are no recommended locales.
1355 content::WebContents* contents = GetWebContents();
1356 ASSERT_TRUE(contents);
1357 bool advanced = false;
1358 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
1359 contents,
1360 base::StringPrintf(
1361 "var pod ="
1362 " document.getElementById('pod-row').getPodWithUsername_('%s');"
1363 "pod.click();"
1364 "domAutomationController.send(pod.classList.contains('advanced'));",
1365 user_id_1_.c_str()),
1366 &advanced));
1367 EXPECT_FALSE(advanced);
1368
1369 // Click the enter button to start the session.
1370 ASSERT_TRUE(content::ExecuteScript(
1371 contents,
1372 base::StringPrintf(
1373 "document.getElementById('pod-row').getPodWithUsername_('%s')"
1374 " .querySelector('.enter-button').click();",
1375 user_id_1_.c_str())));
1376
1311 WaitForSessionStart(); 1377 WaitForSessionStart();
1312 1378
1379 // Verify that the locale has not changed and the first keyboard layout
1380 // applicable to the locale was chosen.
1313 EXPECT_EQ(initial_locale, g_browser_process->GetApplicationLocale()); 1381 EXPECT_EQ(initial_locale, g_browser_process->GetApplicationLocale());
1314 EXPECT_EQ(initial_input_method, 1382 VerifyKeyboardLayoutMatchesLocale();
1315 input_method_manager->GetCurrentInputMethod().id());
1316 } 1383 }
1317 1384
1318 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, SelectLanguageAndKeyboard) { 1385 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, OneRecommendedLocale) {
1319 // Specify startup pages. 1386 // Specify a recommended locale.
1320 device_local_account_policy_.payload().mutable_restoreonstartup()->set_value( 1387 em::StringListPolicyProto* session_locales_proto =
1321 SessionStartupPref::kPrefValueURLs); 1388 device_local_account_policy_.payload().mutable_sessionlocales();
1322 em::StringListPolicyProto* startup_urls_proto = 1389 session_locales_proto->mutable_policy_options()->set_mode(
1323 device_local_account_policy_.payload().mutable_restoreonstartupurls(); 1390 em::PolicyOptions_PolicyMode_RECOMMENDED);
1324 for (size_t i = 0; i < arraysize(kStartupURLs); ++i) 1391 session_locales_proto->mutable_value()->add_entries(kRecommendedLocales1[0]);
pneubeck (no reviews) 2014/07/30 17:55:44 instead of using the unrelated kRecommendedLocales
bartfab (slow) 2014/08/05 17:16:24 Done.
1325 startup_urls_proto->mutable_value()->add_entries(kStartupURLs[i]);
1326 UploadAndInstallDeviceLocalAccountPolicy(); 1392 UploadAndInstallDeviceLocalAccountPolicy();
1327 AddPublicSessionToDevicePolicy(kAccountId1); 1393 AddPublicSessionToDevicePolicy(kAccountId1);
1328 1394
1329 // Log in to the device-local account with a specific locale and keyboard
1330 // layout.
1331 WaitForPolicy(); 1395 WaitForPolicy();
1332 ASSERT_NO_FATAL_FAILURE(WaitForLoginUI()); 1396 ASSERT_NO_FATAL_FAILURE(SkipToLoginScreen());
1333 ASSERT_NO_FATAL_FAILURE( 1397
1334 StartLogin(kPublicSessionLocale, public_session_input_method_id_)); 1398 // Click on the pod to expand it. Verify that the pod expands to its basic
1399 // form as there is only one recommended locale.
1400 content::WebContents* contents = GetWebContents();
1401 ASSERT_TRUE(contents);
1402 bool advanced = false;
1403 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
1404 contents,
1405 base::StringPrintf(
1406 "var pod ="
1407 " document.getElementById('pod-row').getPodWithUsername_('%s');"
1408 "pod.click();"
1409 "domAutomationController.send(pod.classList.contains('advanced'));",
1410 user_id_1_.c_str()),
1411 &advanced));
1412 EXPECT_FALSE(advanced);
1413
1414 // Click the enter button to start the session.
1415 ASSERT_TRUE(content::ExecuteScript(
1416 contents,
1417 base::StringPrintf(
1418 "document.getElementById('pod-row').getPodWithUsername_('%s')"
1419 " .querySelector('.enter-button').click();",
1420 user_id_1_.c_str())));
1421
1335 WaitForSessionStart(); 1422 WaitForSessionStart();
1336 1423
1424 // Verify that the recommended locale has been applied and the first keyboard
1425 // layout applicable to the locale was chosen.
1426 EXPECT_EQ(kRecommendedLocales1[0], g_browser_process->GetApplicationLocale());
1427 VerifyKeyboardLayoutMatchesLocale();
1428 }
1429
1430 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, MultipleRecommendedLocales) {
pneubeck (no reviews) 2014/07/30 17:55:44 can the user also minify the pod after expanding?
bartfab (slow) 2014/08/05 17:16:23 Yes, the pod will contract if it loses focus. The
1431 // Specify recommended locales.
1432 em::StringListPolicyProto* session_locales_proto =
pneubeck (no reviews) 2014/07/30 17:55:44 the setting of the locales could be in helper func
bartfab (slow) 2014/08/05 17:16:24 Done.
1433 device_local_account_policy_.payload().mutable_sessionlocales();
1434 session_locales_proto->mutable_policy_options()->set_mode(
1435 em::PolicyOptions_PolicyMode_RECOMMENDED);
1436 for (size_t i = 0; i < arraysize(kRecommendedLocales1); ++i) {
1437 session_locales_proto->mutable_value()->add_entries(
1438 kRecommendedLocales1[i]);
1439 }
1440 UploadAndInstallDeviceLocalAccountPolicy();
1441 AddPublicSessionToDevicePolicy(kAccountId1);
1442
1443 WaitForPolicy();
1444 ASSERT_NO_FATAL_FAILURE(SkipToLoginScreen());
1445
1446 // Verify that the pod shows a list of locales beginning with the recommended
1447 // ones, followed by others.
1448 content::WebContents* contents = GetWebContents();
1449 ASSERT_TRUE(contents);
1450 const std::string get_locale_list = base::StringPrintf(
1451 "var languageSelect = document.getElementById('pod-row')"
1452 " .getPodWithUsername_('%s').querySelector('.language-select');"
1453 "var locales = [];"
1454 "for (var i = 0; i < languageSelect.length; ++i)"
1455 " locales.push(languageSelect.options[i].value);"
1456 "domAutomationController.send(JSON.stringify(locales));",
1457 user_id_1_.c_str());
1458 std::string json;
1459 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents,
1460 get_locale_list,
1461 &json));
1462 scoped_ptr<base::Value> value_ptr(base::JSONReader::Read(json));
1463 const base::ListValue* locales = NULL;
1464 ASSERT_TRUE(value_ptr);
1465 ASSERT_TRUE(value_ptr->GetAsList(&locales));
1466 EXPECT_LT(arraysize(kRecommendedLocales1), locales->GetSize());
1467 for (size_t i = 0; i < arraysize(kRecommendedLocales1); ++i) {
1468 std::string locale;
1469 EXPECT_TRUE(locales->GetString(i, &locale));
1470 EXPECT_EQ(kRecommendedLocales1[i], locale);
1471 }
1472
1473 // Verify that the first recommended locale is selected.
pneubeck (no reviews) 2014/07/30 15:39:23 It's irritating that you're testing this before th
bartfab (slow) 2014/08/05 17:16:23 Done.
1474 const std::string get_selected_locale =
1475 base::StringPrintf(
pneubeck (no reviews) 2014/07/30 15:39:23 This block and the next together should test: - f
bartfab (slow) 2014/08/05 17:16:23 My test verifies this but the focus is slightly di
1476 "domAutomationController.send(document.getElementById('pod-row')"
1477 " .getPodWithUsername_('%s').querySelector('.language-select')"
1478 " .value);",
1479 user_id_1_.c_str());
1480 std::string selected_locale;
1481 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents,
1482 get_selected_locale,
1483 &selected_locale));
1484 EXPECT_EQ(kRecommendedLocales1[0], selected_locale);
1485
1486 // Click on the pod to expand it. Verify that the pod expands to its advanced
1487 // form directly as there are two or more recommended locales.
pneubeck (no reviews) 2014/07/30 15:39:23 nit: "as there are more than two"
bartfab (slow) 2014/08/05 17:16:24 No, "two or more" is correct. The advanced pod is
1488 bool advanced = false;
1489 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
1490 contents,
1491 base::StringPrintf(
1492 "var pod ="
1493 " document.getElementById('pod-row').getPodWithUsername_('%s');"
1494 "pod.click();"
1495 "domAutomationController.send(pod.classList.contains('advanced'));",
1496 user_id_1_.c_str()),
1497 &advanced));
1498 EXPECT_TRUE(advanced);
1499
1500 // Change the list of recommended locales.
1501 session_locales_proto->mutable_value()->Clear();
1502 for (size_t i = 0; i < arraysize(kRecommendedLocales2); ++i) {
1503 session_locales_proto->mutable_value()->add_entries(
1504 kRecommendedLocales2[i]);
1505 }
pneubeck (no reviews) 2014/07/30 15:39:23 nit: empty line after this one.
bartfab (slow) 2014/08/05 17:16:23 Done.
1506 // Also change the display name as it is easy to ensure that policy has been
1507 // updated by waiting for a display name change.
1508 device_local_account_policy_.payload().mutable_userdisplayname()->set_value(
1509 kDisplayName2);
1510 UploadAndInstallDeviceLocalAccountPolicy();
1511 policy::BrowserPolicyConnectorChromeOS* connector =
1512 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1513 DeviceLocalAccountPolicyBroker* broker =
1514 connector->GetDeviceLocalAccountPolicyService()->GetBrokerForUser(
1515 user_id_1_);
1516 ASSERT_TRUE(broker);
1517 broker->core()->store()->Load();
1518 WaitForDisplayName(user_id_1_, kDisplayName2);
1519
1520 // Verify that the new list of locales is shown in the UI.
1521 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents,
1522 get_locale_list,
1523 &json));
1524 value_ptr.reset(base::JSONReader::Read(json));
pneubeck (no reviews) 2014/07/30 17:55:44 if this code part (JSONReader -> cast to concrete
bartfab (slow) 2014/08/05 17:16:23 I do such a conversion three times in this file. I
1525 locales = NULL;
1526 ASSERT_TRUE(value_ptr);
1527 ASSERT_TRUE(value_ptr->GetAsList(&locales));
1528 EXPECT_LT(arraysize(kRecommendedLocales2), locales->GetSize());
1529 for (size_t i = 0; i < arraysize(kRecommendedLocales2); ++i) {
1530 std::string locale;
1531 EXPECT_TRUE(locales->GetString(i, &locale));
1532 EXPECT_EQ(kRecommendedLocales2[i], locale);
1533 }
1534
1535 // Verify that the first new recommended locale is selected.
1536 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents,
1537 get_selected_locale,
1538 &selected_locale));
1539 EXPECT_EQ(kRecommendedLocales2[0], selected_locale);
1540
1541 // Manually select a different locale.
1542 ASSERT_TRUE(content::ExecuteScript(
1543 contents,
1544 base::StringPrintf(
1545 "var languageSelect = document.getElementById('pod-row')"
1546 " .getPodWithUsername_('%s').querySelector('.language-select');"
1547 "languageSelect.value = '%s';"
1548 "var event = document.createEvent('HTMLEvents');"
1549 "event.initEvent('change', false, true);"
1550 "languageSelect.dispatchEvent(event);",
1551 user_id_1_.c_str(),
1552 kPublicSessionLocale)));
1553
1554 // Change the list of recommended locales.
1555 session_locales_proto->mutable_value()->Clear();
1556 for (size_t i = 0; i < arraysize(kRecommendedLocales1); ++i) {
1557 session_locales_proto->mutable_value()->add_entries(
1558 kRecommendedLocales1[i]);
1559 }
1560 device_local_account_policy_.payload().mutable_userdisplayname()->set_value(
1561 kDisplayName1);
1562 UploadAndInstallDeviceLocalAccountPolicy();
1563 broker->core()->store()->Load();
1564 WaitForDisplayName(user_id_1_, kDisplayName1);
1565
1566 // Verify that the first manually selected locale is still selected.
pneubeck (no reviews) 2014/07/30 17:55:44 what means 'the first manually selected' ? Can the
bartfab (slow) 2014/08/05 17:16:24 Oops, typo. Removed the "first".
1567 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents,
1568 get_selected_locale,
1569 &selected_locale));
1570 EXPECT_EQ(kPublicSessionLocale, selected_locale);
1571
1572 // The UI will have requested an updated list of keyboard layouts at this
pneubeck (no reviews) 2014/07/30 17:55:44 nit: move to a helper "FlushFileThread"
bartfab (slow) 2014/08/05 17:16:23 Done.
1573 // point. Flush the FILE and UI thread loops to allow the process that
1574 // constructs this list to complete.
1575 base::RunLoop run_loop;
1576 content::BrowserThread::PostTaskAndReply(
1577 content::BrowserThread::FILE,
1578 FROM_HERE,
1579 base::Bind(&base::DoNothing),
1580 run_loop.QuitClosure());
1581 run_loop.Run();
1582 base::RunLoop().RunUntilIdle();
1583
1584 // Manually select a different keyboard layout and click the enter button to
1585 // start the session.
1586 ASSERT_TRUE(content::ExecuteScript(
1587 contents,
1588 base::StringPrintf(
1589 "var pod ="
1590 " document.getElementById('pod-row').getPodWithUsername_('%s');"
1591 "pod.querySelector('.keyboard-select').value = '%s';"
1592 "pod.querySelector('.enter-button').click();",
1593 user_id_1_.c_str(),
1594 public_session_input_method_id_.c_str())));
1595
1596 WaitForSessionStart();
1597
1337 // Verify that the locale and keyboard layout have been applied. 1598 // Verify that the locale and keyboard layout have been applied.
pneubeck (no reviews) 2014/07/30 17:55:44 'Verify that the manually selected ...' Hm. Is th
bartfab (slow) 2014/08/05 17:16:24 There are several places where you can pick the lo
1338 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); 1599 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale());
1339 EXPECT_EQ(public_session_input_method_id_, 1600 EXPECT_EQ(public_session_input_method_id_,
1340 chromeos::input_method::InputMethodManager::Get()-> 1601 chromeos::input_method::InputMethodManager::Get()->
1341 GetCurrentInputMethod().id()); 1602 GetCurrentInputMethod().id());
1342 } 1603 }
1343 1604
pneubeck (no reviews) 2014/07/30 15:39:23 will continue review after this part later.
bartfab (slow) 2014/08/05 17:16:24 Acknowledged.
1344 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, 1605 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest,
1345 SelectLanguageAndKeyboardWithTermsOfService) { 1606 AutoLoginWithoutRecommendedLocales) {
pneubeck (no reviews) 2014/07/30 17:55:44 can you compare this to whatever other test maybe
bartfab (slow) 2014/08/05 17:16:23 The only other auto-login tests I am aware of are
1607 const std::string initial_locale = g_browser_process->GetApplicationLocale();
1608
1609 UploadAndInstallDeviceLocalAccountPolicy();
1610 AddPublicSessionToDevicePolicy(kAccountId1);
1611 EnableAutoLogin();
1612
1613 WaitForPolicy();
1614 ASSERT_NO_FATAL_FAILURE(SkipToLoginScreen());
1615
1616 WaitForSessionStart();
1617
1618 // Verify that the locale has not changed and the first keyboard layout
1619 // applicable to the locale was chosen.
1620 EXPECT_EQ(initial_locale, g_browser_process->GetApplicationLocale());
1621 VerifyKeyboardLayoutMatchesLocale();
1622 }
1623
1624 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest,
1625 AutoLoginWithRecommendedLocales) {
1626 // Specify recommended locales.
1627 em::StringListPolicyProto* session_locales_proto =
1628 device_local_account_policy_.payload().mutable_sessionlocales();
1629 session_locales_proto->mutable_policy_options()->set_mode(
1630 em::PolicyOptions_PolicyMode_RECOMMENDED);
1631 for (size_t i = 0; i < arraysize(kRecommendedLocales1); ++i) {
1632 session_locales_proto->mutable_value()->add_entries(
1633 kRecommendedLocales1[i]);
1634 }
1635 UploadAndInstallDeviceLocalAccountPolicy();
1636 AddPublicSessionToDevicePolicy(kAccountId1);
1637 EnableAutoLogin();
1638
1639 WaitForPolicy();
1640 ASSERT_NO_FATAL_FAILURE(SkipToLoginScreen());
1641
1642 WaitForSessionStart();
1643
1644 // Verify that the first recommended locale has been applied and the first
1645 // keyboard layout applicable to the locale was chosen.
1646 EXPECT_EQ(kRecommendedLocales1[0], g_browser_process->GetApplicationLocale());
1647 VerifyKeyboardLayoutMatchesLocale();
1648 }
1649
1650 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, TermsOfServiceWithLocaleSwitch) {
1346 // Specify Terms of Service URL. 1651 // Specify Terms of Service URL.
1347 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 1652 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
1348 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( 1653 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value(
1349 embedded_test_server()->GetURL( 1654 embedded_test_server()->GetURL(
1350 std::string("/") + kExistentTermsOfServicePath).spec()); 1655 std::string("/") + kExistentTermsOfServicePath).spec());
1351 UploadAndInstallDeviceLocalAccountPolicy(); 1656 UploadAndInstallDeviceLocalAccountPolicy();
1352 AddPublicSessionToDevicePolicy(kAccountId1); 1657 AddPublicSessionToDevicePolicy(kAccountId1);
1353 1658
1354 // Log in to the device-local account with a specific locale and keyboard
1355 // layout.
1356 WaitForPolicy(); 1659 WaitForPolicy();
1357 ASSERT_NO_FATAL_FAILURE(WaitForLoginUI()); 1660 ASSERT_NO_FATAL_FAILURE(SkipToLoginScreen());
1358 ASSERT_NO_FATAL_FAILURE( 1661
1359 StartLogin(kPublicSessionLocale, public_session_input_method_id_)); 1662 // Select a different locale.
1663 content::WebContents* contents = GetWebContents();
1664 ASSERT_TRUE(contents);
1665 ASSERT_TRUE(content::ExecuteScript(
1666 contents,
1667 base::StringPrintf(
1668 "var languageSelect = document.getElementById('pod-row')"
1669 " .getPodWithUsername_('%s').querySelector('.language-select');"
1670 "languageSelect.value = '%s';"
1671 "var event = document.createEvent('HTMLEvents');"
1672 "event.initEvent('change', false, true);"
1673 "languageSelect.dispatchEvent(event);",
1674 user_id_1_.c_str(),
1675 kPublicSessionLocale)));
1676
1677 // The UI will have requested an updated list of keyboard layouts at this
1678 // point. Flush the FILE and UI thread loops to allow the process that
1679 // constructs this list to complete.
1680 base::RunLoop run_loop;
1681 content::BrowserThread::PostTaskAndReply(
1682 content::BrowserThread::FILE,
1683 FROM_HERE,
1684 base::Bind(&base::DoNothing),
1685 run_loop.QuitClosure());
1686 run_loop.Run();
1687 base::RunLoop().RunUntilIdle();
1360 1688
1361 // Set up an observer that will quit the message loop when login has succeeded 1689 // Set up an observer that will quit the message loop when login has succeeded
1362 // and the first wizard screen, if any, is being shown. 1690 // and the first wizard screen, if any, is being shown.
1363 base::RunLoop login_wait_run_loop; 1691 base::RunLoop login_wait_run_loop;
1364 chromeos::MockAuthStatusConsumer login_status_consumer; 1692 chromeos::MockAuthStatusConsumer login_status_consumer;
1365 EXPECT_CALL(login_status_consumer, OnAuthSuccess(_)).Times(1).WillOnce( 1693 EXPECT_CALL(login_status_consumer, OnAuthSuccess(_)).Times(1).WillOnce(
1366 InvokeWithoutArgs(&login_wait_run_loop, &base::RunLoop::Quit)); 1694 InvokeWithoutArgs(&login_wait_run_loop, &base::RunLoop::Quit));
1367
1368 // Spin the loop until the observer fires. Then, unregister the observer.
1369 chromeos::ExistingUserController* controller = 1695 chromeos::ExistingUserController* controller =
1370 chromeos::ExistingUserController::current_controller(); 1696 chromeos::ExistingUserController::current_controller();
1371 ASSERT_TRUE(controller); 1697 ASSERT_TRUE(controller);
1372 controller->set_login_status_consumer(&login_status_consumer); 1698 controller->set_login_status_consumer(&login_status_consumer);
1699
1700 // Manually select a different keyboard layout and click the enter button to
1701 // start the session.
1702 ASSERT_TRUE(content::ExecuteScript(
1703 contents,
1704 base::StringPrintf(
1705 "var pod ="
1706 " document.getElementById('pod-row').getPodWithUsername_('%s');"
1707 "pod.querySelector('.keyboard-select').value = '%s';"
1708 "pod.querySelector('.enter-button').click();",
1709 user_id_1_.c_str(),
1710 public_session_input_method_id_.c_str())));
1711
1712 // Spin the loop until the login observer fires. Then, unregister the
1713 // observer.
1373 login_wait_run_loop.Run(); 1714 login_wait_run_loop.Run();
1374 controller->set_login_status_consumer(NULL); 1715 controller->set_login_status_consumer(NULL);
1375 1716
1376 // Verify that the Terms of Service screen is being shown. 1717 // Verify that the Terms of Service screen is being shown.
1377 chromeos::WizardController* wizard_controller = 1718 chromeos::WizardController* wizard_controller =
1378 chromeos::WizardController::default_controller(); 1719 chromeos::WizardController::default_controller();
1379 ASSERT_TRUE(wizard_controller); 1720 ASSERT_TRUE(wizard_controller);
1380 ASSERT_TRUE(wizard_controller->current_screen()); 1721 ASSERT_TRUE(wizard_controller->current_screen());
1381 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName, 1722 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName,
1382 wizard_controller->current_screen()->GetName()); 1723 wizard_controller->current_screen()->GetName());
1383 1724
1384 // Wait for the Terms of Service to finish downloading. 1725 // Wait for the Terms of Service to finish downloading.
1385 chromeos::LoginDisplayHostImpl* host =
1386 reinterpret_cast<chromeos::LoginDisplayHostImpl*>(
1387 chromeos::LoginDisplayHostImpl::default_host());
1388 ASSERT_TRUE(host);
1389 chromeos::WebUILoginView* web_ui_login_view = host->GetWebUILoginView();
1390 ASSERT_TRUE(web_ui_login_view);
1391 content::WebUI* web_ui = web_ui_login_view->GetWebUI();
1392 ASSERT_TRUE(web_ui);
1393 content::WebContents* contents = web_ui->GetWebContents();
1394 ASSERT_TRUE(contents);
1395 bool done = false; 1726 bool done = false;
1396 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(contents, 1727 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(contents,
1397 "var screenElement = document.getElementById('terms-of-service');" 1728 "var screenElement = document.getElementById('terms-of-service');"
1398 "function SendReplyIfDownloadDone() {" 1729 "function SendReplyIfDownloadDone() {"
1399 " if (screenElement.classList.contains('tos-loading'))" 1730 " if (screenElement.classList.contains('tos-loading'))"
1400 " return false;" 1731 " return false;"
1401 " domAutomationController.send(true);" 1732 " domAutomationController.send(true);"
1402 " observer.disconnect();" 1733 " observer.disconnect();"
1403 " return true;" 1734 " return true;"
1404 "}" 1735 "}"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 // Verify that the Terms of Service screen is being shown. 1796 // Verify that the Terms of Service screen is being shown.
1466 chromeos::WizardController* wizard_controller = 1797 chromeos::WizardController* wizard_controller =
1467 chromeos::WizardController::default_controller(); 1798 chromeos::WizardController::default_controller();
1468 ASSERT_TRUE(wizard_controller); 1799 ASSERT_TRUE(wizard_controller);
1469 ASSERT_TRUE(wizard_controller->current_screen()); 1800 ASSERT_TRUE(wizard_controller->current_screen());
1470 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName, 1801 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName,
1471 wizard_controller->current_screen()->GetName()); 1802 wizard_controller->current_screen()->GetName());
1472 1803
1473 // Wait for the Terms of Service to finish downloading, then get the status of 1804 // Wait for the Terms of Service to finish downloading, then get the status of
1474 // the screen's UI elements. 1805 // the screen's UI elements.
1475 chromeos::LoginDisplayHostImpl* host = 1806 content::WebContents* contents = GetWebContents();
1476 reinterpret_cast<chromeos::LoginDisplayHostImpl*>(
1477 chromeos::LoginDisplayHostImpl::default_host());
1478 ASSERT_TRUE(host);
1479 chromeos::WebUILoginView* web_ui_login_view = host->GetWebUILoginView();
1480 ASSERT_TRUE(web_ui_login_view);
1481 content::WebUI* web_ui = web_ui_login_view->GetWebUI();
1482 ASSERT_TRUE(web_ui);
1483 content::WebContents* contents = web_ui->GetWebContents();
1484 ASSERT_TRUE(contents); 1807 ASSERT_TRUE(contents);
1485 std::string json; 1808 std::string json;
1486 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents, 1809 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents,
1487 "var screenElement = document.getElementById('terms-of-service');" 1810 "var screenElement = document.getElementById('terms-of-service');"
1488 "function SendReplyIfDownloadDone() {" 1811 "function SendReplyIfDownloadDone() {"
1489 " if (screenElement.classList.contains('tos-loading'))" 1812 " if (screenElement.classList.contains('tos-loading'))"
1490 " return false;" 1813 " return false;"
1491 " var status = {};" 1814 " var status = {};"
1492 " status.heading = document.getElementById('tos-heading').textContent;" 1815 " status.heading = document.getElementById('tos-heading').textContent;"
1493 " status.subheading =" 1816 " status.subheading ="
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 ASSERT_TRUE(content::ExecuteScript(contents, 1886 ASSERT_TRUE(content::ExecuteScript(contents,
1564 "$('tos-accept-button').click();")); 1887 "$('tos-accept-button').click();"));
1565 1888
1566 WaitForSessionStart(); 1889 WaitForSessionStart();
1567 } 1890 }
1568 1891
1569 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, 1892 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance,
1570 TermsOfServiceDownloadTest, testing::Bool()); 1893 TermsOfServiceDownloadTest, testing::Bool());
1571 1894
1572 } // namespace policy 1895 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698