| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  220       "name": "Bookmarks", |  220       "name": "Bookmarks", | 
|  221       "num_entries": 2793, |  221       "num_entries": 2793, | 
|  222       "num_live": 2793, |  222       "num_live": 2793, | 
|  223       "status": "ok", |  223       "status": "ok", | 
|  224       "value": "Active: GROUP_UI" |  224       "value": "Active: GROUP_UI" | 
|  225     }, |  225     }, | 
|  226   ], |  226   ], | 
|  227   "unrecoverable_error_detected": false |  227   "unrecoverable_error_detected": false | 
|  228 }; |  228 }; | 
|  229  |  229  | 
 |  230 NETWORK_EVENT_DETAILS_1 = { | 
 |  231   "details":"Notified types: Bookmarks, Autofill", | 
 |  232   "proto":{}, | 
 |  233   "time":1395874542192.407, | 
 |  234   "type":"Normal GetUpdate request" | 
 |  235 }; | 
 |  236  | 
 |  237 NETWORK_EVENT_DETAILS_2 = { | 
 |  238   "details":"Received error: SYNC_AUTH_ERROR", | 
 |  239   "proto":{}, | 
 |  240   "time":1395874542192.837, | 
 |  241   "type":"GetUpdates Response" | 
 |  242 }; | 
 |  243  | 
|  230 TEST_F('SyncInternalsWebUITest', 'Uninitialized', function() { |  244 TEST_F('SyncInternalsWebUITest', 'Uninitialized', function() { | 
|  231   assertNotEquals(null, chrome.sync.aboutInfo); |  245   assertNotEquals(null, chrome.sync.aboutInfo); | 
|  232   expectTrue(this.hasInDetails(true, 'Username', '')); |  246   expectTrue(this.hasInDetails(true, 'Username', '')); | 
|  233   expectTrue(this.hasInDetails(false, 'Summary', 'Uninitialized')); |  247   expectTrue(this.hasInDetails(false, 'Summary', 'Uninitialized')); | 
|  234 }); |  248 }); | 
|  235  |  249  | 
|  236 TEST_F('SyncInternalsWebUITest', 'LoadPastedAboutInfo', function() { |  250 TEST_F('SyncInternalsWebUITest', 'LoadPastedAboutInfo', function() { | 
|  237   // Expose the text field. |  251   // Expose the text field. | 
|  238   $('import-status').click(); |  252   $('import-status').click(); | 
|  239  |  253  | 
|  240   // Fill it with fake data. |  254   // Fill it with fake data. | 
|  241   $('status-text').value = JSON.stringify(HARD_CODED_ABOUT_INFO); |  255   $('status-text').value = JSON.stringify(HARD_CODED_ABOUT_INFO); | 
|  242  |  256  | 
|  243   // Trigger the import. |  257   // Trigger the import. | 
|  244   $('import-status').click(); |  258   $('import-status').click(); | 
|  245  |  259  | 
|  246   expectTrue(this.hasInDetails(true, 'Summary', 'Sync service initialized')); |  260   expectTrue(this.hasInDetails(true, 'Summary', 'Sync service initialized')); | 
|  247 }); |  261 }); | 
|  248  |  262  | 
 |  263 TEST_F('SyncInternalsWebUITest', 'NetworkEventsTest', function() { | 
 |  264   networkEvent1 = new Event('onProtocolEvent'); | 
 |  265   networkEvent1.details = NETWORK_EVENT_DETAILS_1; | 
 |  266   networkEvent2 = new Event('onProtocolEvent'); | 
 |  267   networkEvent2.details = NETWORK_EVENT_DETAILS_2; | 
 |  268  | 
 |  269   chrome.sync.events.dispatchEvent(networkEvent1); | 
 |  270   chrome.sync.events.dispatchEvent(networkEvent2); | 
 |  271  | 
 |  272   expectEquals(2, $('traffic-event-container').children.length); | 
 |  273  | 
 |  274   // Test that repeated events are not re-displayed. | 
 |  275   chrome.sync.events.dispatchEvent(networkEvent1); | 
 |  276   expectEquals(2, $('traffic-event-container').children.length); | 
 |  277 }); | 
 |  278  | 
|  249 TEST_F('SyncInternalsWebUITest', 'SearchTabDoesntChangeOnItemSelect', |  279 TEST_F('SyncInternalsWebUITest', 'SearchTabDoesntChangeOnItemSelect', | 
|  250        function() { |  280        function() { | 
|  251   // Select the search tab. |  281   // Select the search tab. | 
|  252   $('sync-search-tab').selected = true; |  282   $('sync-search-tab').selected = true; | 
|  253   expectTrue($('sync-search-tab').selected); |  283   expectTrue($('sync-search-tab').selected); | 
|  254  |  284  | 
|  255   // Build the data model and attach to result list. |  285   // Build the data model and attach to result list. | 
|  256   cr.ui.List.decorate($('sync-results-list')); |  286   cr.ui.List.decorate($('sync-results-list')); | 
|  257   $('sync-results-list').dataModel = new cr.ui.ArrayDataModel([ |  287   $('sync-results-list').dataModel = new cr.ui.ArrayDataModel([ | 
|  258     { |  288     { | 
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  358  |  388  | 
|  359   // Click the dump-to-text button. |  389   // Click the dump-to-text button. | 
|  360   $('dump-to-text').click(); |  390   $('dump-to-text').click(); | 
|  361  |  391  | 
|  362   // Verify our event is among the results. |  392   // Verify our event is among the results. | 
|  363   var eventDumpText = $('data-dump').textContent; |  393   var eventDumpText = $('data-dump').textContent; | 
|  364  |  394  | 
|  365   expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0); |  395   expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0); | 
|  366   expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0); |  396   expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0); | 
|  367 }); |  397 }); | 
| OLD | NEW |