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

Side by Side Diff: chrome/browser/chromeos/login/webview_login_browsertest.cc

Issue 1054403002: Basic tests for new webview based signin flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove flaky back-button check Created 5 years, 8 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chrome_notification_types.h"
6 #include "chrome/browser/chromeos/login/test/oobe_base_test.h"
7 #include "chrome/browser/chromeos/login/ui/webui_login_display.h"
8 #include "chromeos/chromeos_switches.h"
9 #include "content/public/test/browser_test_utils.h"
10 #include "content/public/test/test_utils.h"
11
12 namespace chromeos {
13 namespace {
14 const char kFakeUserEmail[] = "fake-email@gmail.com";
15 const char kFakeUserPassword[] = "fake-password";
16 const char kFakeSIDCookie[] = "fake-SID-cookie";
17 const char kFakeLSIDCookie[] = "fake-LSID-cookie";
18 }
19
20 class WebviewLoginTest : public OobeBaseTest {
21 public:
22 WebviewLoginTest() { use_webview_ = true; }
23 ~WebviewLoginTest() override {}
24
25 void SetUpOnMainThread() override {
26 fake_gaia_->SetFakeMergeSessionParams(kFakeUserEmail, kFakeSIDCookie,
27 kFakeLSIDCookie);
28
29 OobeBaseTest::SetUpOnMainThread();
30 }
31
32 void SetUpCommandLine(base::CommandLine* command_line) override {
33 command_line->AppendSwitch(switches::kOobeSkipPostLogin);
34 OobeBaseTest::SetUpCommandLine(command_line);
35 }
36
37 void WaitForGaiaPageLoaded() {
38 WaitForSigninScreen();
39
40 ASSERT_TRUE(content::ExecuteScript(
41 GetLoginUI()->GetWebContents(),
42 "$('gaia-signin').gaiaAuthHost_.addEventListener('ready',"
43 "function() {"
44 "window.domAutomationController.setAutomationId(0);"
45 "window.domAutomationController.send('GaiaReady');"
46 "});"));
47
48 content::DOMMessageQueue message_queue;
49 GetLoginDisplay()->ShowSigninScreenForCreds("", "");
50
51 std::string message;
52 ASSERT_TRUE(message_queue.WaitForMessage(&message));
53 EXPECT_EQ("\"GaiaReady\"", message);
54 }
55
56 private:
57 DISALLOW_COPY_AND_ASSIGN(WebviewLoginTest);
58 };
59
60 IN_PROC_BROWSER_TEST_F(WebviewLoginTest, Basic) {
61 WaitForGaiaPageLoaded();
62
63 JsExpect("$('close-button-item').hidden");
64
65 SetSignFormField("identifier", kFakeUserEmail);
66 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
67
68 JsExpect("$('close-button-item').hidden");
69
70 content::WindowedNotificationObserver session_start_waiter(
71 chrome::NOTIFICATION_SESSION_STARTED,
72 content::NotificationService::AllSources());
73
74 SetSignFormField("password", kFakeUserPassword);
75 ExecuteJsInSigninFrame("document.getElementById('nextButton').click();");
76
77 session_start_waiter.Wait();
78 }
79
80 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/test/oobe_base_test.cc ('k') | chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698