Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/ui/webui/sync_internals_browsertest.js

Issue 224563004: sync: Re-implement getAllNodes WebUI function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 } 54 }
55 return false; 55 return false;
56 } 56 }
57 }; 57 };
58 58
59 /** 59 /**
60 * Constant hard-coded value to return from mock getAllNodes. 60 * Constant hard-coded value to return from mock getAllNodes.
61 * @const 61 * @const
62 */ 62 */
63 var HARD_CODED_ALL_NODES = [ 63 var HARD_CODED_ALL_NODES = [{
64 { 64 "nodes": [{
65 "BASE_SERVER_SPECIFICS": {}, 65 "ATTACHMENT_METADATA": "",
66 "BASE_VERSION": "1388699799780000", 66 "BASE_SERVER_SPECIFICS": {},
67 "CTIME": "Wednesday, December 31, 1969 4:00:00 PM", 67 "BASE_VERSION": "1396470970810000",
68 "ID": "sZ:ADqtAZw5kjSwSkukraMoMX6z0OlFXENzhA+1HZNcO6LbATQrkVenHJS5" + 68 "CTIME": "Wednesday, December 31, 1969 4:00:00 PM",
69 "AgICYfj8/6KcvwlCw3FIvcRFtOEP3zSP5YJ1VH53/Q==", 69 "ID": "sZ:ADqtAZwzF4GOIyvkI2enSI62AU5p/7MNmvuSSyf7yXJ1SkJwpp1YL" +
70 "IS_DEL": false, 70 "6bbMkF8inzqW+EO6n2aPJ/uXccW9GHxorBlnKoZAWHVzg==",
71 "IS_DIR": true, 71 "IS_DEL": false,
72 "IS_UNAPPLIED_UPDATE": false, 72 "IS_DIR": true,
73 "IS_UNSYNCED": false, 73 "IS_UNAPPLIED_UPDATE": false,
74 "LOCAL_EXTERNAL_ID": "0", 74 "IS_UNSYNCED": false,
75 "META_HANDLE": "376", 75 "LOCAL_EXTERNAL_ID": "0",
76 "MTIME": "Wednesday, December 31, 1969 4:00:00 PM", 76 "META_HANDLE": "387",
77 "NON_UNIQUE_NAME": "Typed URLs", 77 "MTIME": "Wednesday, December 31, 1969 4:00:00 PM",
78 "PARENT_ID": "r", 78 "NON_UNIQUE_NAME": "Autofill",
79 "SERVER_CTIME": "Wednesday, December 31, 1969 4:00:00 PM", 79 "PARENT_ID": "r",
80 "SERVER_IS_DEL": false, 80 "SERVER_CTIME": "Wednesday, December 31, 1969 4:00:00 PM",
81 "SERVER_IS_DIR": true, 81 "SERVER_IS_DEL": false,
82 "SERVER_MTIME": "Wednesday, December 31, 1969 4:00:00 PM", 82 "SERVER_IS_DIR": true,
83 "SERVER_NON_UNIQUE_NAME": "Typed URLs", 83 "SERVER_MTIME": "Wednesday, December 31, 1969 4:00:00 PM",
84 "SERVER_PARENT_ID": "r", 84 "SERVER_NON_UNIQUE_NAME": "Autofill",
85 "SERVER_SPECIFICS": { 85 "SERVER_PARENT_ID": "r",
86 "typed_url": { 86 "SERVER_SPECIFICS": {
87 "visit_transitions": [], 87 "autofill": {
88 "visits": [] 88 "usage_timestamp": []
89 } 89 }
90 }, 90 },
91 "SERVER_UNIQUE_POSITION": "INVALID[]", 91 "SERVER_UNIQUE_POSITION": "INVALID[]",
92 "SERVER_VERSION": "1388699799780000", 92 "SERVER_VERSION": "1396470970810000",
93 "SPECIFICS": { 93 "SPECIFICS": {
94 "typed_url": { 94 "autofill": {
95 "visit_transitions": [], 95 "usage_timestamp": []
96 "visits": [] 96 }
97 } 97 },
98 }, 98 "SYNCING": false,
99 "SYNCING": false, 99 "TRANSACTION_VERSION": "1",
100 "TRANSACTION_VERSION": "1", 100 "UNIQUE_BOOKMARK_TAG": "",
101 "UNIQUE_BOOKMARK_TAG": "", 101 "UNIQUE_CLIENT_TAG": "",
102 "UNIQUE_CLIENT_TAG": "", 102 "UNIQUE_POSITION": "INVALID[]",
103 "UNIQUE_POSITION": "INVALID[]", 103 "UNIQUE_SERVER_TAG": "google_chrome_autofill",
104 "UNIQUE_SERVER_TAG": "google_chrome_typed_urls", 104 "isDirty": false,
105 "isDirty": false, 105 "serverModelType": "Autofill"
106 "serverModelType": "Typed URLs" 106 }, {
107 }, 107 "ATTACHMENT_METADATA": "",
108 { 108 "BASE_SERVER_SPECIFICS": {},
109 "BASE_SERVER_SPECIFICS": {}, 109 "BASE_VERSION": "1394241139528639",
110 "BASE_VERSION": "1372291923970334", 110 "CTIME": "Friday, March 7, 2014 5:12:19 PM",
111 "CTIME": "Wednesday, June 26, 2013 5:12:03 PM", 111 "ID": "sZ:ADqtAZwzc/ol1iaz+yNLjjWak9PBE0o/hATzpqJsyq/HX2xzV2f88" +
112 "ID": "sZ:ADqtAZyz70DhOIusPT1v2XCd/8YT8Fy43WlqdRyH6UwoBAqMkX5Pnkl/sW9A" + 112 "FaOrT7HDE4tyn7zx2LWgkAFvZfCA5mOy4p0XFgiY0L+mw==",
113 "+AVrmzAPWFTrRBf0AWD57HyN4GcYXwSR9q4lYA==", 113 "IS_DEL": false,
114 "IS_DEL": false, 114 "IS_DIR": false,
115 "IS_DIR": false, 115 "IS_UNAPPLIED_UPDATE": false,
116 "IS_UNAPPLIED_UPDATE": false, 116 "IS_UNSYNCED": false,
117 "IS_UNSYNCED": false, 117 "LOCAL_EXTERNAL_ID": "0",
118 "LOCAL_EXTERNAL_ID": "0", 118 "META_HANDLE": "2989",
119 "META_HANDLE": "3011", 119 "MTIME": "Friday, March 7, 2014 5:12:19 PM",
120 "MTIME": "Wednesday, June 26, 2013 5:12:03 PM", 120 "NON_UNIQUE_NAME": "autofill_entry|Email|rlsynctet2",
121 "NON_UNIQUE_NAME": "http://chrome.com/", 121 "PARENT_ID": "sZ:ADqtAZwzF4GOIyvkI2enSI62AU5p/7MNmvuSSyf7yXJ1Sk" +
122 "PARENT_ID": "sZ:ADqtAZw5kjSwSkukraMoMX6z0OlFXENzhA+1HZNcO6LbATQrkVen" + 122 "Jwpp1YL6bbMkF8inzqW+EO6n2aPJ/uXccW9GHxorBlnKoZAWHVzg==",
123 "HJS5AgICYfj8/6KcvwlCw3FIvcRFtOEP3zSP5YJ1VH53/Q==", 123 "SERVER_CTIME": "Friday, March 7, 2014 5:12:19 PM",
124 "SERVER_CTIME": "Wednesday, June 26, 2013 5:12:03 PM", 124 "SERVER_IS_DEL": false,
125 "SERVER_IS_DEL": false, 125 "SERVER_IS_DIR": false,
126 "SERVER_IS_DIR": false, 126 "SERVER_MTIME": "Friday, March 7, 2014 5:12:19 PM",
127 "SERVER_MTIME": "Wednesday, June 26, 2013 5:12:03 PM", 127 "SERVER_NON_UNIQUE_NAME": "autofill_entry|Email|rlsynctet2",
128 "SERVER_NON_UNIQUE_NAME": "http://chrome.com/", 128 "SERVER_PARENT_ID": "sZ:ADqtAZwzF4GOIyvkI2enSI62AU5p/7MNmvuSSyf" +
129 "SERVER_PARENT_ID": "sZ:ADqtAZw5kjSwSkukraMoMX6z0OlFXENzhA+1HZNcO6LbAT" + 129 "7yXJ1SkJwpp1YL6bbMkF8inzqW+EO6n2aPJ/uXccW9GHxorBlnKoZAWHVzg==",
130 "QrkVenHJS5AgICYfj8/6KcvwlCw3FIvcRFtOEP3zSP5YJ1VH53/Q==", 130 "SERVER_SPECIFICS": {
131 "SERVER_SPECIFICS": { 131 "autofill": {
132 "typed_url": { 132 "name": "Email",
133 "hidden": false, 133 "usage_timestamp": ["13038713887000000", "13038713890000000"],
134 "title": "Chrome", 134 "value": "rlsynctet2"
135 "url": "http://chrome.com/", 135 }
136 "visit_transitions": [ 136 },
137 "268435457" 137 "SERVER_UNIQUE_POSITION": "INVALID[]",
138 ], 138 "SERVER_VERSION": "1394241139528639",
139 "visits": [ 139 "SPECIFICS": {
140 "13016765523677321" 140 "autofill": {
141 ] 141 "name": "Email",
142 } 142 "usage_timestamp": ["13038713887000000", "13038713890000000"],
143 }, 143 "value": "rlsynctet2"
144 "SERVER_UNIQUE_POSITION": "INVALID[]", 144 }
145 "SERVER_VERSION": "1372291923970334", 145 },
146 "SPECIFICS": { 146 "SYNCING": false,
147 "typed_url": { 147 "TRANSACTION_VERSION": "1",
148 "hidden": false, 148 "UNIQUE_BOOKMARK_TAG": "",
149 "title": "Chrome", 149 "UNIQUE_CLIENT_TAG": "EvliorKUf1rLjT+BGkNZp586Tsk=",
150 "url": "http://chrome.com/", 150 "UNIQUE_POSITION": "INVALID[]",
151 "visit_transitions": [ 151 "UNIQUE_SERVER_TAG": "",
152 "268435457" 152 "isDirty": false,
153 ], 153 "serverModelType": "Autofill"
154 "visits": [ 154 }],
155 "13016765523677321" 155 "type": "Autofill"
156 ] 156 }];
157 }
158 },
159 "SYNCING": false,
160 "TRANSACTION_VERSION": "1",
161 "UNIQUE_BOOKMARK_TAG": "",
162 "UNIQUE_CLIENT_TAG": "J28uWKpXPuQwR3SJKbuLqzYGOcM=",
163 "UNIQUE_POSITION": "INVALID[]",
164 "UNIQUE_SERVER_TAG": "",
165 "isDirty": false,
166 "serverModelType": "Typed URLs"
167 }
168 ];
169 157
170 /** 158 /**
171 * A value to return in mock onReceivedUpdatedAboutInfo event. 159 * A value to return in mock onReceivedUpdatedAboutInfo event.
172 * @const 160 * @const
173 */ 161 */
174 HARD_CODED_ABOUT_INFO = { 162 HARD_CODED_ABOUT_INFO = {
175 "actionable_error": [ 163 "actionable_error": [
176 { 164 {
177 "is_valid": false, 165 "is_valid": false,
178 "stat_name": "Error Type", 166 "stat_name": "Error Type",
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 toString: function() { return 'node 1'; }, 282 toString: function() { return 'node 1'; },
295 } 283 }
296 ]); 284 ]);
297 285
298 // Select the first list item and verify the search tab remains selected. 286 // Select the first list item and verify the search tab remains selected.
299 $('sync-results-list').getListItemByIndex(0).selected = true; 287 $('sync-results-list').getListItemByIndex(0).selected = true;
300 expectTrue($('sync-search-tab').selected); 288 expectTrue($('sync-search-tab').selected);
301 }); 289 });
302 290
303 TEST_F('SyncInternalsWebUITest', 'NodeBrowserTest', function() { 291 TEST_F('SyncInternalsWebUITest', 'NodeBrowserTest', function() {
304 this.mockHandler.expects(once()).getAllNodes([]).will( 292 var getAllNodesSavedArgs = new SaveMockArguments();
305 callFunction(function() { 293 this.mockHandler.expects(once()).
306 chrome.sync.getAllNodes.handleReply(HARD_CODED_ALL_NODES); 294 getAllNodes(getAllNodesSavedArgs.match(ANYTHING)).
307 })); 295 will(callFunctionWithSavedArgs(getAllNodesSavedArgs,
296 chrome.sync.getAllNodesCallback,
297 HARD_CODED_ALL_NODES));
308 298
309 // Hit the refresh button. 299 // Hit the refresh button.
310 $('node-browser-refresh-button').click(); 300 $('node-browser-refresh-button').click();
311 301
312 // Check that the refresh time was updated. 302 // Check that the refresh time was updated.
313 expectNotEquals($('node-browser-refresh-time').textContent, 'Never'); 303 expectNotEquals($('node-browser-refresh-time').textContent, 'Never');
314 304
315 // Verify some hard-coded assumptions. These depend on the vaue of the 305 // Verify some hard-coded assumptions. These depend on the vaue of the
316 // hard-coded nodes, specified elsewhere in this file. 306 // hard-coded nodes, specified elsewhere in this file.
317 307
(...skipping 10 matching lines...) Expand all
328 // An actual sync node. The child of the type root. 318 // An actual sync node. The child of the type root.
329 var leaf = typeRoot.items[0]; 319 var leaf = typeRoot.items[0];
330 320
331 // Verify that selecting it affects the details view. 321 // Verify that selecting it affects the details view.
332 expectTrue($('node-details').hasAttribute('hidden')); 322 expectTrue($('node-details').hasAttribute('hidden'));
333 leaf.selected = true; 323 leaf.selected = true;
334 expectFalse($('node-details').hasAttribute('hidden')); 324 expectFalse($('node-details').hasAttribute('hidden'));
335 }); 325 });
336 326
337 TEST_F('SyncInternalsWebUITest', 'NodeBrowserRefreshOnTabSelect', function() { 327 TEST_F('SyncInternalsWebUITest', 'NodeBrowserRefreshOnTabSelect', function() {
338 this.mockHandler.expects(once()).getAllNodes([]).will( 328 var getAllNodesSavedArgs = new SaveMockArguments();
339 callFunction(function() { 329 this.mockHandler.expects(once()).
340 chrome.sync.getAllNodes.handleReply(HARD_CODED_ALL_NODES); 330 getAllNodes(getAllNodesSavedArgs.match(ANYTHING)).
341 })); 331 will(callFunctionWithSavedArgs(getAllNodesSavedArgs,
332 chrome.sync.getAllNodesCallback,
333 HARD_CODED_ALL_NODES));
342 334
343 // Should start with non-refreshed node browser. 335 // Should start with non-refreshed node browser.
344 expectEquals($('node-browser-refresh-time').textContent, 'Never'); 336 expectEquals($('node-browser-refresh-time').textContent, 'Never');
345 337
346 // Selecting the tab will refresh it. 338 // Selecting the tab will refresh it.
347 $('sync-browser-tab').selected = true; 339 $('sync-browser-tab').selected = true;
348 expectNotEquals($('node-browser-refresh-time').textContent, 'Never'); 340 expectNotEquals($('node-browser-refresh-time').textContent, 'Never');
349 341
350 // Re-selecting the tab shouldn't re-refresh. 342 // Re-selecting the tab shouldn't re-refresh.
351 $('node-browser-refresh-time').textContent = 'TestCanary'; 343 $('node-browser-refresh-time').textContent = 'TestCanary';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 380
389 // Click the dump-to-text button. 381 // Click the dump-to-text button.
390 $('dump-to-text').click(); 382 $('dump-to-text').click();
391 383
392 // Verify our event is among the results. 384 // Verify our event is among the results.
393 var eventDumpText = $('data-dump').textContent; 385 var eventDumpText = $('data-dump').textContent;
394 386
395 expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0); 387 expectGE(eventDumpText.indexOf('onConnectionStatusChange'), 0);
396 expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0); 388 expectGE(eventDumpText.indexOf('CONNECTION_OK'), 0);
397 }); 389 });
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/ui/webui/sync_internals_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698