OLD | NEW |
---|---|
(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() { | |
James Hawkins
2011/11/10 00:24:43
This helper method only makes one call. Just inlin
Sheridan Rawlins
2011/11/10 02:02:12
Done.
| |
38 assertFalse(PersonalOptions.getInstance().syncSetupCompleted); | |
39 }, | |
40 | |
41 /** | |
42 * Clicks the "Sign in to Chrome" button. | |
43 */ | |
44 startSyncing: function() { | |
45 var startStopSyncButton = $('start-stop-sync'); | |
James Hawkins
2011/11/10 00:24:43
Tests should not be querying elements using ID.
Sheridan Rawlins
2011/11/10 02:02:12
Done.
| |
46 assertNotEquals(null, startStopSyncButton); | |
47 this.mockHandler.expects(once()).SyncSetupShowSetupUI(). | |
48 will(callFunction(function() { | |
49 OptionsPage.navigateToPage('syncSetup'); | |
James Hawkins
2011/11/10 00:24:43
Two space indentation.
Sheridan Rawlins
2011/11/10 02:02:12
Done.
| |
50 })); | |
51 | |
52 this.mockHandler.expects(once()).SyncSetupAttachHandler(). | |
53 will(callFunction(function() { | |
54 SyncSetupOverlay.showSyncSetupPage( | |
55 'login', { | |
56 user: '', | |
57 error: 0, | |
58 editable_user: true, | |
59 }); | |
60 })); | |
61 startStopSyncButton.click(); | |
62 }, | |
63 }; | |
64 | |
65 // Verify that initial state is unsynced, start syncing, then login. | |
66 TEST_F('SyncSetupWebUITest', 'VerifySignIn', function() { | |
67 this.verifyUnsynced(); | |
68 this.startSyncing(); | |
69 | |
70 // Find the DOM objects on the page. | |
James Hawkins
2011/11/10 00:24:43
s/Find/Verify/
Sheridan Rawlins
2011/11/10 02:02:12
Done.
| |
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 // Set up mock expectations | |
James Hawkins
2011/11/10 00:24:43
period at end of sentence; however, this particula
Sheridan Rawlins
2011/11/10 02:02:12
Done.
| |
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. | |
James Hawkins
2011/11/10 00:24:43
Capitalize sentence.
Sheridan Rawlins
2011/11/10 02:02:12
Done.
| |
86 gaiaEmail.value = 'foo@bar.baz'; | |
87 gaiaPasswd.value = 'foo@bar.baz'; | |
88 signInButton.click(); | |
89 }); | |
90 | |
OLD | NEW |