Chromium Code Reviews| Index: chrome/browser/ui/webui/sync_internals_browsertest.js |
| diff --git a/chrome/browser/ui/webui/sync_internals_browsertest.js b/chrome/browser/ui/webui/sync_internals_browsertest.js |
| index 733bac59692a9f403e9d0809775371cac4b0725f..139e1f6049761d955f95692fa3909da535a1fa34 100644 |
| --- a/chrome/browser/ui/webui/sync_internals_browsertest.js |
| +++ b/chrome/browser/ui/webui/sync_internals_browsertest.js |
| @@ -18,6 +18,12 @@ SyncInternalsWebUITest.prototype = { |
| */ |
| browsePreload: 'chrome://sync-internals', |
| + /** |
| + * Disable accessibility testing for this page. |
| + * @override |
| + */ |
| + runAccessibilityChecks: false, |
| + |
| /** @override */ |
| preLoad: function() { |
| this.makeAndRegisterMockHandler([ |
| @@ -158,12 +164,81 @@ var HARD_CODED_ALL_NODES = [ |
| } |
| ]; |
| +HARD_CODED_ABOUT_INFO = { |
|
Dan Beam
2014/02/12 01:25:00
nit:
/** @const */
var HARD_CODED_ABOUT_INFO = {
rlarocque
2014/02/12 02:07:39
Done.
|
| + "actionable_error": [ |
| + { |
| + "is_valid": false, |
| + "stat_name": "Error Type", |
| + "stat_value": "Uninitialized" |
| + }, |
| + { |
| + "is_valid": false, |
| + "stat_name": "Action", |
| + "stat_value": "Uninitialized" |
| + }, |
| + { |
| + "is_valid": false, |
| + "stat_name": "URL", |
| + "stat_value": "Uninitialized" |
| + }, |
| + { |
| + "is_valid": false, |
| + "stat_name": "Error Description", |
| + "stat_value": "Uninitialized" |
| + } |
| + ], |
| + "actionable_error_detected": false, |
| + "details": [ |
| + { |
| + "data": [ |
| + { |
| + "is_valid": true, |
| + "stat_name": "Summary", |
| + "stat_value": "Sync service initialized" |
| + } |
| + ], |
| + "is_sensitive": false, |
| + "title": "Summary" |
| + }, |
| + ], |
| + "type_status": [ |
| + { |
| + "name": "Model Type", |
| + "num_entries": "Total Entries", |
| + "num_live": "Live Entries", |
| + "status": "header", |
| + "value": "Group Type" |
| + }, |
| + { |
| + "name": "Bookmarks", |
| + "num_entries": 2793, |
| + "num_live": 2793, |
| + "status": "ok", |
| + "value": "Active: GROUP_UI" |
| + }, |
| + ], |
| + "unrecoverable_error_detected": false |
| +}; |
| + |
| TEST_F('SyncInternalsWebUITest', 'Uninitialized', function() { |
| assertNotEquals(null, chrome.sync.aboutInfo); |
| expectTrue(this.hasInDetails(true, 'Username', '')); |
| expectTrue(this.hasInDetails(false, 'Summary', 'Uninitialized')); |
| }); |
| +TEST_F('SyncInternalsWebUITest', 'LoadPastedAboutInfo', function() { |
| + // Expose the text field. |
| + $('import-status').click(); |
| + |
| + // Fill it with fake data. |
| + $('status-text').value = JSON.stringify(HARD_CODED_ABOUT_INFO); |
| + |
| + // Trigger the import. |
| + $('import-status').click(); |
| + |
| + expectTrue(this.hasInDetails(true, 'Summary', 'Sync service initialized')); |
| +}); |
| + |
| TEST_F('SyncInternalsWebUITest', 'SearchTabDoesntChangeOnItemSelect', |
| function() { |
| // Select the search tab. |
| @@ -241,3 +316,45 @@ TEST_F('SyncInternalsWebUITest', 'NodeBrowserRefreshOnTabSelect', function() { |
| $('sync-browser-tab').selected = true; |
| expectEquals($('node-browser-refresh-time').textContent, 'TestCanary'); |
| }); |
| + |
| +// Tests that the events log page correctly receives and displays an event. |
| +TEST_F('SyncInternalsWebUITest', 'EventLogTest', function() { |
| + // Dispatch an event. |
| + var connectionEvent = new Event('onConnectionStatusChange'); |
| + connectionEvent.details = {'status': 'CONNECTION_OK'}; |
| + chrome.sync.events.dispatchEvent(connectionEvent); |
| + |
| + // Verify that it is displayed in the events log. |
| + var syncEventsTable = $('sync-events'); |
| + var firstRow = syncEventsTable.children[0]; |
| + |
| + // Makes some assumptions about column ordering. We'll need re-think this if |
| + // it turns out to be a maintenance burden. |
| + assertEquals(4, firstRow.children.length); |
| + var submoduleName = firstRow.children[1].textContent; |
| + var eventName = firstRow.children[2].textContent; |
| + var detailsText = firstRow.children[3].textContent; |
| + |
| + expectGE(submoduleName.indexOf('manager'), 0, |
| + 'submoduleName=' + submoduleName); |
| + expectGE(eventName.indexOf('onConnectionStatusChange'), 0, |
| + 'eventName=' + eventName); |
| + expectGE(detailsText.indexOf('CONNECTION_OK'), 0, |
| + 'detailsText=' + detailsText); |
| +}); |
| + |
| +TEST_F('SyncInternalsWebUITest', 'DumpSyncEventsToText', function() { |
| + // Dispatch an event. |
| + var connectionEvent = new Event('onConnectionStatusChange'); |
| + connectionEvent.details = { 'status': 'CONNECTION_OK' } |
|
Dan Beam
2014/02/12 01:25:00
remove \s between { and } here, too
rlarocque
2014/02/12 02:07:39
Done.
|
| + chrome.sync.events.dispatchEvent(connectionEvent); |
| + |
| + // Click the dump-to-text button. |
| + $('dump-to-text').click(); |
| + |
| + // Verify our event is among the results. |
| + var eventDumpText = $('data-dump').textContent; |
| + |
| + expectTrue(eventDumpText.indexOf('onConnectionStatusChange') != -1); |
| + expectTrue(eventDumpText.indexOf('CONNECTION_OK') != -1); |
|
Dan Beam
2014/02/12 01:25:00
^ update these as well, IMO, to use expectNE
rlarocque
2014/02/12 02:07:39
I went with GE 0, since that's what I ended up usi
|
| +}); |