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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 connectionEvent.details = {'status': 'CONNECTION_OK'}; | 353 connectionEvent.details = {'status': 'CONNECTION_OK'}; |
354 chrome.sync.events.dispatchEvent(connectionEvent); | 354 chrome.sync.events.dispatchEvent(connectionEvent); |
355 | 355 |
356 // Verify that it is displayed in the events log. | 356 // Verify that it is displayed in the events log. |
357 var syncEventsTable = $('sync-events'); | 357 var syncEventsTable = $('sync-events'); |
358 var firstRow = syncEventsTable.children[0]; | 358 var firstRow = syncEventsTable.children[0]; |
359 | 359 |
360 // Makes some assumptions about column ordering. We'll need re-think this if | 360 // Makes some assumptions about column ordering. We'll need re-think this if |
361 // it turns out to be a maintenance burden. | 361 // it turns out to be a maintenance burden. |
362 assertEquals(4, firstRow.children.length); | 362 assertEquals(4, firstRow.children.length); |
| 363 var detailsText = firstRow.children[0].textContent; |
363 var submoduleName = firstRow.children[1].textContent; | 364 var submoduleName = firstRow.children[1].textContent; |
364 var eventName = firstRow.children[2].textContent; | 365 var eventName = firstRow.children[2].textContent; |
365 var detailsText = firstRow.children[3].textContent; | |
366 | 366 |
367 expectGE(submoduleName.indexOf('manager'), 0, | 367 expectGE(submoduleName.indexOf('manager'), 0, |
368 'submoduleName=' + submoduleName); | 368 'submoduleName=' + submoduleName); |
369 expectGE(eventName.indexOf('onConnectionStatusChange'), 0, | 369 expectGE(eventName.indexOf('onConnectionStatusChange'), 0, |
370 'eventName=' + eventName); | 370 'eventName=' + eventName); |
371 expectGE(detailsText.indexOf('CONNECTION_OK'), 0, | 371 expectGE(detailsText.indexOf('CONNECTION_OK'), 0, |
372 'detailsText=' + detailsText); | 372 'detailsText=' + detailsText); |
373 }); | 373 }); |
374 | 374 |
375 TEST_F('SyncInternalsWebUITest', 'DumpSyncEventsToText', function() { | 375 TEST_F('SyncInternalsWebUITest', 'DumpSyncEventsToText', function() { |
376 // Dispatch an event. | 376 // Dispatch an event. |
377 var connectionEvent = new Event('onConnectionStatusChange'); | 377 var connectionEvent = new Event('onConnectionStatusChange'); |
378 connectionEvent.details = {'status': 'CONNECTION_OK'}; | 378 connectionEvent.details = {'status': 'CONNECTION_OK'}; |
379 chrome.sync.events.dispatchEvent(connectionEvent); | 379 chrome.sync.events.dispatchEvent(connectionEvent); |
380 | 380 |
381 // Click the dump-to-text button. | 381 // Click the dump-to-text button. |
382 $('dump-to-text').click(); | 382 $('dump-to-text').click(); |
383 | 383 |
384 // Verify our event is among the results. | 384 // Verify our event is among the results. |
385 var eventDumpText = $('data-dump').textContent; | 385 var eventDumpText = $('data-dump').textContent; |
386 | 386 |
387 expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0); | 387 expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0); |
388 expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0); | 388 expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0); |
389 }); | 389 }); |
OLD | NEW |