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
3 // found in the LICENSE file.
5 GEN('#if !defined(OS_CHROMEOS)');
8 * Test fixture for sync setup WebUI testing.
10 * @extends {testing.Test}
12 function SyncSetupWebUITest() {}
14 SyncSetupWebUITest
.prototype = {
15 __proto__
: testing
.Test
.prototype,
18 * Browse to the settings sub-frame.
20 browsePreload
: 'chrome://settings-frame',
24 this.makeAndRegisterMockHandler(['SyncSetupConfigure',
25 'SyncSetupShowSetupUI',
26 'SyncSetupStartSignIn',
31 * Verifies starting point is not synced.
33 verifyUnsynced: function() {
34 assertFalse(BrowserOptions
.getInstance().signedIn_
);
38 * Clicks the "Sign in to Chrome" button.
40 startSyncing: function() {
41 var startStopSyncButton
= BrowserOptions
.getStartStopSyncButton();
42 assertNotEquals(null, startStopSyncButton
);
43 startStopSyncButton
.click();
48 * Async version of SyncSetupWebUITest.
49 * @extends {SyncSetupWebUITest}
52 function SyncSetupWebUITestAsync() {}
54 SyncSetupWebUITestAsync
.prototype = {
55 __proto__
: SyncSetupWebUITest
.prototype,
61 // Verify that initial state is unsynced, click the sign in button, verify
62 // that the sync setup dialog appears, and dismiss it.
63 TEST_F('SyncSetupWebUITestAsync', 'VerifySignIn', function() {
64 // Make sure the user is not starting off in the signed in or syncing state.
65 this.verifyUnsynced();
67 // Handle SyncSetupShowSetupUI by navigating to chrome://settings/syncSetup.
68 this.mockHandler
.expects(once()).SyncSetupShowSetupUI().
69 will(callFunction(function() {
70 PageManager
.showPageByName('syncSetup');
73 // Handle SyncSetupStartSignIn by displaying the sync setup dialog, verifying
74 // that a confirmation dialog appears, and clicking OK to dismiss the dialog.
75 // Note that this test doesn't actually do a gaia sign in.
76 this.mockHandler
.expects(once()).SyncSetupStartSignIn().
77 will(callFunction(function() {
78 SyncSetupOverlay
.showSyncSetupPage('configure');
79 var okButton
= $('confirm-everything-ok');
80 assertNotEquals(null, okButton
);
84 // The test completes after the sync config is sent out.
85 this.mockHandler
.expects(once()).SyncSetupConfigure(ANYTHING
).
86 will(callFunction(testDone
));
88 // For testing, don't wait to execute timeouts.
89 var oldSetTimeout
= setTimeout
;
90 setTimeout = function(fn
, timeout
) {
94 // Kick off the test by clicking the "Sign in to Chrome..." button.
98 GEN('#endif // OS_CHROMEOS');