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 CrosSettings::Get()->SetBoolean(kAccountsPrefAllowGuest, false); | 86 chromeos::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 WaitForGaiaPageLoad(); | |
93 | |
94 std::string frame_url = "$('gaia-signin').gaiaAuthHost_.initialFrameUrl_"; | |
95 // New users are allowed. | |
96 JsExpect(frame_url + ".search('flow=nosignup') == -1"); | |
97 | |
98 // Disallow new users - we also need to set a whitelist due to weird logic. | |
99 CrosSettings::Get()->Set(kAccountsPrefUsers, base::ListValue()); | |
100 CrosSettings::Get()->SetBoolean(kAccountsPrefAllowNewUser, false); | |
101 WaitForGaiaPageReload(); | |
102 | |
103 // flow=nosignup indicates that user creation is not allowed. | |
104 JsExpect(frame_url + ".search('flow=nosignup') != -1"); | |
105 } | |
106 | |
107 } // namespace chromeos | 90 } // namespace chromeos |
OLD | NEW |