| 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 GEN('#if !defined(OS_CHROMEOS)'); | 5 GEN('#if !defined(OS_CHROMEOS)'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Test fixture for sync setup WebUI testing. | 8 * Test fixture for sync setup WebUI testing. |
| 9 * @constructor | 9 * @constructor |
| 10 * @extends {testing.Test} | 10 * @extends {testing.Test} |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 function() { | 78 function() { |
| 79 PageManager.showPageByName('syncSetup'); | 79 PageManager.showPageByName('syncSetup'); |
| 80 })); | 80 })); |
| 81 }, | 81 }, |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 TEST_F('SyncSetupWebUITestAsync', 'VerifySignIn', function() { | 84 TEST_F('SyncSetupWebUITestAsync', 'VerifySignIn', function() { |
| 85 // Handle SyncSetupStartSignIn by displaying the sync setup dialog, verifying | 85 // Handle SyncSetupStartSignIn by displaying the sync setup dialog, verifying |
| 86 // that a confirmation dialog appears, and clicking OK to dismiss the dialog. | 86 // that a confirmation dialog appears, and clicking OK to dismiss the dialog. |
| 87 // Note that this test doesn't actually do a gaia sign in. | 87 // Note that this test doesn't actually do a gaia sign in. |
| 88 this.mockHandler.expects(once()).SyncSetupStartSignIn().will(callFunction( | 88 this.mockHandler.expects(once()).SyncSetupStartSignIn('access-point-settings')
.will(callFunction( |
| 89 function() { | 89 function() { |
| 90 SyncSetupOverlay.showSyncSetupPage('configure'); | 90 SyncSetupOverlay.showSyncSetupPage('configure'); |
| 91 var okButton = $('confirm-everything-ok'); | 91 var okButton = $('confirm-everything-ok'); |
| 92 assertNotEquals(null, okButton); | 92 assertNotEquals(null, okButton); |
| 93 okButton.click(); | 93 okButton.click(); |
| 94 })); | 94 })); |
| 95 | 95 |
| 96 // The test completes after the sync config is sent out. | 96 // The test completes after the sync config is sent out. |
| 97 this.mockHandler.expects(once()).SyncSetupConfigure(ANYTHING). | 97 this.mockHandler.expects(once()).SyncSetupConfigure(ANYTHING). |
| 98 will(callFunction(testDone)); | 98 will(callFunction(testDone)); |
| 99 | 99 |
| 100 // Click the "Sign in to Chrome..." button. | 100 // Click the "Sign in to Chrome..." button. |
| 101 this.startSyncing(); | 101 this.startSyncing(); |
| 102 }); | 102 }); |
| 103 | 103 |
| 104 // Test that switching to and from "Sync everything" saves and restores types. | 104 // Test that switching to and from "Sync everything" saves and restores types. |
| 105 TEST_F('SyncSetupWebUITestAsync', 'RestoreSyncDataTypes', function() { | 105 TEST_F('SyncSetupWebUITestAsync', 'RestoreSyncDataTypes', function() { |
| 106 this.mockHandler.expects(once()).SyncSetupStartSignIn().will(callFunction( | 106 this.mockHandler.expects(once()).SyncSetupStartSignIn('access-point-settings')
.will(callFunction( |
| 107 function() { | 107 function() { |
| 108 SyncSetupOverlay.showSyncSetupPage('configure', {}); | 108 SyncSetupOverlay.showSyncSetupPage('configure', {}); |
| 109 | 109 |
| 110 $('sync-select-datatypes').selectedIndex = 1; | 110 $('sync-select-datatypes').selectedIndex = 1; |
| 111 cr.dispatchSimpleEvent($('sync-select-datatypes'), 'change', true); | 111 cr.dispatchSimpleEvent($('sync-select-datatypes'), 'change', true); |
| 112 | 112 |
| 113 $('bookmarks-checkbox').checked = false; | 113 $('bookmarks-checkbox').checked = false; |
| 114 cr.dispatchSimpleEvent($('bookmarks-checkbox'), 'change', true); | 114 cr.dispatchSimpleEvent($('bookmarks-checkbox'), 'change', true); |
| 115 | 115 |
| 116 $('sync-select-datatypes').selectedIndex = 0; | 116 $('sync-select-datatypes').selectedIndex = 0; |
| 117 cr.dispatchSimpleEvent($('sync-select-datatypes'), 'change', true); | 117 cr.dispatchSimpleEvent($('sync-select-datatypes'), 'change', true); |
| 118 assertTrue($('bookmarks-checkbox').checked); | 118 assertTrue($('bookmarks-checkbox').checked); |
| 119 | 119 |
| 120 $('sync-select-datatypes').selectedIndex = 1; | 120 $('sync-select-datatypes').selectedIndex = 1; |
| 121 cr.dispatchSimpleEvent($('sync-select-datatypes'), 'change', true); | 121 cr.dispatchSimpleEvent($('sync-select-datatypes'), 'change', true); |
| 122 assertFalse($('bookmarks-checkbox').checked); | 122 assertFalse($('bookmarks-checkbox').checked); |
| 123 | 123 |
| 124 testDone(); | 124 testDone(); |
| 125 })); | 125 })); |
| 126 | 126 |
| 127 this.startSyncing(); | 127 this.startSyncing(); |
| 128 }); | 128 }); |
| 129 | 129 |
| 130 GEN('#endif // OS_CHROMEOS'); | 130 GEN('#endif // OS_CHROMEOS'); |
| OLD | NEW |