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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 content::WindowedNotificationObserver session_start_waiter( | 68 content::WindowedNotificationObserver session_start_waiter( |
69 chrome::NOTIFICATION_SESSION_STARTED, | 69 chrome::NOTIFICATION_SESSION_STARTED, |
70 content::NotificationService::AllSources()); | 70 content::NotificationService::AllSources()); |
71 | 71 |
72 SetSignFormField("password", kFakeUserPassword); | 72 SetSignFormField("password", kFakeUserPassword); |
73 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();"); | 73 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();"); |
74 | 74 |
75 session_start_waiter.Wait(); | 75 session_start_waiter.Wait(); |
76 } | 76 } |
77 | 77 |
| 78 IN_PROC_BROWSER_TEST_F(WebviewLoginTest, BackButton) { |
| 79 WaitForGaiaPageLoaded(); |
| 80 |
| 81 // Start: no back button, first page. |
| 82 JsExpect("$('back-button-item').hidden"); |
| 83 JsExpect("$('signin-frame').src.indexOf('#identifier') != -1"); |
| 84 |
| 85 // Next step: back button active, second page. |
| 86 SetSignFormField("identifier", kFakeUserEmail); |
| 87 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();"); |
| 88 JsExpect("!$('back-button-item').hidden"); |
| 89 JsExpect("$('signin-frame').src.indexOf('#challengepassword') != -1"); |
| 90 |
| 91 // One step back: no back button, first page. |
| 92 ASSERT_TRUE(content::ExecuteScript(GetLoginUI()->GetWebContents(), |
| 93 "$('back-button-item').click();")); |
| 94 JsExpect("$('back-button-item').hidden"); |
| 95 JsExpect("$('signin-frame').src.indexOf('#identifier') != -1"); |
| 96 |
| 97 // Next step (again): back button active, second page, user id remembered. |
| 98 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();"); |
| 99 JsExpect("!$('back-button-item').hidden"); |
| 100 JsExpect("$('signin-frame').src.indexOf('#challengepassword') != -1"); |
| 101 |
| 102 content::WindowedNotificationObserver session_start_waiter( |
| 103 chrome::NOTIFICATION_SESSION_STARTED, |
| 104 content::NotificationService::AllSources()); |
| 105 |
| 106 SetSignFormField("password", kFakeUserPassword); |
| 107 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();"); |
| 108 |
| 109 session_start_waiter.Wait(); |
| 110 } |
| 111 |
78 } // namespace chromeos | 112 } // namespace chromeos |
OLD | NEW |