| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 internals WebUI testing. | 6 * Test fixture for sync internals WebUI testing. |
| 7 * @constructor | 7 * @constructor |
| 8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
| 9 */ | 9 */ |
| 10 function SyncInternalsWebUITest() {} | 10 function SyncInternalsWebUITest() {} |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 NETWORK_EVENT_DETAILS_2 = { | 225 NETWORK_EVENT_DETAILS_2 = { |
| 226 'details': 'Received error: SYNC_AUTH_ERROR', | 226 'details': 'Received error: SYNC_AUTH_ERROR', |
| 227 'proto': {}, | 227 'proto': {}, |
| 228 'time': 1395874542192.837, | 228 'time': 1395874542192.837, |
| 229 'type': 'GetUpdates Response', | 229 'type': 'GetUpdates Response', |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 TEST_F('SyncInternalsWebUITest', 'Uninitialized', function() { | 232 TEST_F('SyncInternalsWebUITest', 'Uninitialized', function() { |
| 233 assertNotEquals(null, chrome.sync.aboutInfo); | 233 assertNotEquals(null, chrome.sync.aboutInfo); |
| 234 expectTrue(this.hasInDetails(true, 'Username', '')); | |
| 235 expectTrue(this.hasInDetails(false, 'Summary', 'Uninitialized')); | 234 expectTrue(this.hasInDetails(false, 'Summary', 'Uninitialized')); |
| 236 }); | 235 }); |
| 237 | 236 |
| 237 // Test that username is set correctly when the user is signed in or not. |
| 238 // On chromeos, browser tests are signed in by default. On other platforms, |
| 239 // browser tests are signed out. |
| 240 GEN('#if defined(OS_CHROMEOS)'); |
| 241 TEST_F('SyncInternalsWebUITest', 'SignedIn', function() { |
| 242 assertNotEquals(null, chrome.sync.aboutInfo); |
| 243 expectTrue(this.hasInDetails(true, 'Username', 'stub-user@example.com')); |
| 244 }); |
| 245 GEN('#else'); |
| 246 TEST_F('SyncInternalsWebUITest', 'SignedOut', function() { |
| 247 assertNotEquals(null, chrome.sync.aboutInfo); |
| 248 expectTrue(this.hasInDetails(true, 'Username', '')); |
| 249 }); |
| 250 GEN('#endif // defined(OS_CHROMEOS)'); |
| 251 |
| 238 TEST_F('SyncInternalsWebUITest', 'LoadPastedAboutInfo', function() { | 252 TEST_F('SyncInternalsWebUITest', 'LoadPastedAboutInfo', function() { |
| 239 // Expose the text field. | 253 // Expose the text field. |
| 240 $('import-status').click(); | 254 $('import-status').click(); |
| 241 | 255 |
| 242 // Fill it with fake data. | 256 // Fill it with fake data. |
| 243 $('status-text').value = JSON.stringify(HARD_CODED_ABOUT_INFO); | 257 $('status-text').value = JSON.stringify(HARD_CODED_ABOUT_INFO); |
| 244 | 258 |
| 245 // Trigger the import. | 259 // Trigger the import. |
| 246 $('import-status').click(); | 260 $('import-status').click(); |
| 247 | 261 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 394 |
| 381 // Click the dump-to-text button. | 395 // Click the dump-to-text button. |
| 382 $('dump-to-text').click(); | 396 $('dump-to-text').click(); |
| 383 | 397 |
| 384 // Verify our event is among the results. | 398 // Verify our event is among the results. |
| 385 var eventDumpText = $('data-dump').textContent; | 399 var eventDumpText = $('data-dump').textContent; |
| 386 | 400 |
| 387 expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0); | 401 expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0); |
| 388 expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0); | 402 expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0); |
| 389 }); | 403 }); |
| OLD | NEW |