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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_browsertest.js

Issue 8503003: Seed test for SyncUI: sign in successfully with mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use makeAndRegisterMockHandler in new ChromeSendWebUITest. Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/webui/options/options_browsertest.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 /**
6 * Test fixture for sync setup WebUI testing.
7 * @constructor
8 * @extends {testing.Test}
9 */
10 function SyncSetupWebUITest() {}
11
12 SyncSetupWebUITest.prototype = {
13 __proto__: testing.Test.prototype,
14
15 /**
16 * Browse to personal options.
17 **/
18 browsePreload: 'chrome://settings/personal',
19
20 /** @inheritDoc */
21 preLoad: function() {
22 this.makeAndRegisterMockHandler(['stopSyncing',
23 'SyncSetupDidClosePage',
24 'SyncSetupSubmitAuth',
25 'SyncSetupConfigure',
26 'SyncSetupPassphrase',
27 'SyncSetupPassphraseCancel',
28 'SyncSetupAttachHandler',
29 'SyncSetupShowErrorUI',
30 'SyncSetupShowSetupUI',
31 ]);
32 },
33
34 /**
35 * Verifies starting point is not synced.
36 */
37 verifyUnsynced: function() {
38 },
39
40 /**
41 * Clicks the "Sign in to Chrome" button.
42 */
43 startSyncing: function() {
44 var startStopSyncButton = PersonalOptions.getStartStopSyncButton();
45 assertNotEquals(null, startStopSyncButton);
46 this.mockHandler.expects(once()).SyncSetupShowSetupUI().
47 will(callFunction(function() {
48 OptionsPage.navigateToPage('syncSetup');
49 }));
50
51 this.mockHandler.expects(once()).SyncSetupAttachHandler().
52 will(callFunction(function() {
53 SyncSetupOverlay.showSyncSetupPage(
54 'login', {
55 user: '',
56 error: 0,
57 editable_user: true,
58 });
59 }));
60 startStopSyncButton.click();
61 },
62 };
63
64 // Verify that initial state is unsynced, start syncing, then login.
65 TEST_F('SyncSetupWebUITest', 'VerifySignIn', function() {
66 // Start syncing to pull up the sign in page.
67 assertFalse(PersonalOptions.getInstance().syncSetupCompleted);
68 this.startSyncing();
69
70 // Verify the DOM objects on the page.
71 var gaiaEmail = SyncSetupOverlay.getLoginEmail();
72 assertNotEquals(null, gaiaEmail);
73 var gaiaPasswd = SyncSetupOverlay.getLoginPasswd();
74 assertNotEquals(null, gaiaPasswd);
75 var signInButton = SyncSetupOverlay.getSignInButton();
76 assertNotEquals(null, signInButton);
77
78 // Expect set up submission and close messages sent through chrome.send().
79 this.mockHandler.expects(once()).SyncSetupSubmitAuth(NOT_NULL).
80 will(callFunction(function() {
81 SyncSetupOverlay.showSuccessAndClose();
82 }));
83 this.mockHandler.expects(once()).SyncSetupDidClosePage();
84
85 // Set the email & password, then sign in.
86 gaiaEmail.value = 'foo@bar.baz';
87 gaiaPasswd.value = 'foo@bar.baz';
88 signInButton.click();
89 });
90
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/options_browsertest.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698