OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chrome_notification_types.h" | 5 #include "chrome/browser/chrome_notification_types.h" |
6 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 6 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
7 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 7 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
8 #include "chromeos/chromeos_switches.h" | 8 #include "chromeos/chromeos_switches.h" |
9 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
10 #include "content/public/test/test_utils.h" | 10 #include "content/public/test/test_utils.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 SetSignFormField("password", OobeBaseTest::kFakeUserPassword); | 77 SetSignFormField("password", OobeBaseTest::kFakeUserPassword); |
78 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();"); | 78 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();"); |
79 | 79 |
80 session_start_waiter.Wait(); | 80 session_start_waiter.Wait(); |
81 } | 81 } |
82 | 82 |
83 IN_PROC_BROWSER_TEST_F(WebviewLoginTest, AllowGuest) { | 83 IN_PROC_BROWSER_TEST_F(WebviewLoginTest, AllowGuest) { |
84 WaitForGaiaPageLoad(); | 84 WaitForGaiaPageLoad(); |
85 JsExpect("!$('guest-user-header-bar-item').hidden"); | 85 JsExpect("!$('guest-user-header-bar-item').hidden"); |
86 chromeos::CrosSettings::Get()->SetBoolean(kAccountsPrefAllowGuest, false); | 86 CrosSettings::Get()->SetBoolean(kAccountsPrefAllowGuest, false); |
87 JsExpect("$('guest-user-header-bar-item').hidden"); | 87 JsExpect("$('guest-user-header-bar-item').hidden"); |
88 } | 88 } |
89 | 89 |
| 90 // Create new account option should be available only if the settings allow it. |
| 91 IN_PROC_BROWSER_TEST_F(WebviewLoginTest, AllowNewUser) { |
| 92 DisableRestrictiveProxyCheck(); |
| 93 WaitForGaiaPageLoad(); |
| 94 |
| 95 std::string frame_url = "$('gaia-signin').gaiaAuthHost_.reloadUrl_"; |
| 96 // New users are allowed. |
| 97 JsExpect(frame_url + ".search('flow=nosignup') == -1"); |
| 98 |
| 99 // Disallow new users - we also need to set a whitelist due to weird logic. |
| 100 CrosSettings::Get()->Set(kAccountsPrefUsers, base::ListValue()); |
| 101 CrosSettings::Get()->SetBoolean(kAccountsPrefAllowNewUser, false); |
| 102 WaitForGaiaPageReload(); |
| 103 |
| 104 // flow=nosignup indicates that user creation is not allowed. |
| 105 JsExpect(frame_url + ".search('flow=nosignup') != -1"); |
| 106 } |
| 107 |
90 } // namespace chromeos | 108 } // namespace chromeos |
OLD | NEW |