OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * Test fixture for sync setup WebUI testing. | 6 * Test fixture for sync setup WebUI testing. |
7 * @constructor | 7 * @constructor |
8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
9 */ | 9 */ |
10 function SyncSetupWebUITest() {} | 10 function SyncSetupWebUITest() {} |
11 | 11 |
12 SyncSetupWebUITest.prototype = { | 12 SyncSetupWebUITest.prototype = { |
13 __proto__: testing.Test.prototype, | 13 __proto__: testing.Test.prototype, |
14 | 14 |
15 /** | 15 /** |
16 * Browse to settings. | 16 * Browse to settings. |
17 */ | 17 */ |
18 browsePreload: 'chrome://settings-frame', | 18 browsePreload: 'chrome://settings-frame', |
19 | 19 |
20 /** @inheritDoc */ | 20 /** @inheritDoc */ |
21 preLoad: function() { | 21 preLoad: function() { |
22 this.makeAndRegisterMockHandler(['stopSyncing', | 22 this.makeAndRegisterMockHandler(['stopSyncing', |
23 'SyncSetupDidClosePage', | 23 'SyncSetupDidClosePage', |
24 'SyncSetupSubmitAuth', | 24 'SyncSetupSubmitAuth', |
25 'SyncSetupConfigure', | 25 'SyncSetupConfigure', |
26 'SyncSetupPassphrase', | 26 'SyncSetupPassphrase', |
27 'SyncSetupPassphraseCancel', | 27 'SyncSetupPassphraseCancel', |
28 'SyncSetupAttachHandler', | |
29 'SyncSetupShowErrorUI', | 28 'SyncSetupShowErrorUI', |
30 'SyncSetupShowSetupUI', | 29 'SyncSetupShowSetupUI', |
31 ]); | 30 ]); |
32 }, | 31 }, |
33 | 32 |
34 /** | 33 /** |
35 * Verifies starting point is not synced. | 34 * Verifies starting point is not synced. |
36 */ | 35 */ |
37 verifyUnsynced: function() { | 36 verifyUnsynced: function() { |
38 }, | 37 }, |
39 | 38 |
40 /** | 39 /** |
41 * Clicks the "Sign in to Chrome" button. | 40 * Clicks the "Sign in to Chrome" button. |
42 */ | 41 */ |
43 startSyncing: function() { | 42 startSyncing: function() { |
44 var startStopSyncButton = BrowserOptions.getStartStopSyncButton(); | 43 var startStopSyncButton = BrowserOptions.getStartStopSyncButton(); |
45 assertNotEquals(null, startStopSyncButton); | 44 assertNotEquals(null, startStopSyncButton); |
46 this.mockHandler.expects(once()).SyncSetupShowSetupUI(). | 45 this.mockHandler.expects(once()).SyncSetupShowSetupUI(). |
47 will(callFunction(function() { | 46 will(callFunction(function() { |
48 OptionsPage.navigateToPage('syncSetup'); | 47 OptionsPage.navigateToPage('syncSetup'); |
49 })); | 48 })); |
50 | 49 |
51 this.mockHandler.expects(once()).SyncSetupAttachHandler(NOT_NULL). | 50 this.mockHandler.expects(once()).SyncSetupShowSetupUI(). |
52 will(callFunction(function() { | 51 will(callFunction(function() { |
53 SyncSetupOverlay.showSyncSetupPage( | 52 SyncSetupOverlay.showSyncSetupPage( |
54 'login', { | 53 'login', { |
55 user: '', | 54 user: '', |
56 error: 0, | 55 error: 0, |
57 editable_user: true, | 56 editable_user: true, |
58 }); | 57 }); |
59 })); | 58 })); |
60 startStopSyncButton.click(); | 59 startStopSyncButton.click(); |
61 }, | 60 }, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 })); | 106 })); |
108 // The test completes after the asynchronous close. | 107 // The test completes after the asynchronous close. |
109 this.mockHandler.expects(once()).SyncSetupDidClosePage(). | 108 this.mockHandler.expects(once()).SyncSetupDidClosePage(). |
110 will(callFunction(testDone)); | 109 will(callFunction(testDone)); |
111 | 110 |
112 // Set the email & password, then sign in. | 111 // Set the email & password, then sign in. |
113 gaiaEmail.value = 'foo@bar.baz'; | 112 gaiaEmail.value = 'foo@bar.baz'; |
114 gaiaPasswd.value = 'foo@bar.baz'; | 113 gaiaPasswd.value = 'foo@bar.baz'; |
115 signInButton.click(); | 114 signInButton.click(); |
116 }); | 115 }); |
OLD | NEW |