OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 * TestFixture for Invalidations WebUI testing. | 6 * TestFixture for Invalidations WebUI testing. |
7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
8 * @constructor | 8 * @constructor |
9 **/ | 9 **/ |
10 function InvalidationsWebUITest() {} | 10 function InvalidationsWebUITest() {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 chrome.invalidations.updateState(newNewState); | 53 chrome.invalidations.updateState(newNewState); |
54 expectEquals(invalidationsState.textContent, | 54 expectEquals(invalidationsState.textContent, |
55 'TRANSIENT_INVALIDATION_ERROR'); | 55 'TRANSIENT_INVALIDATION_ERROR'); |
56 var isContained = | 56 var isContained = |
57 invalidationsLog.value.indexOf( | 57 invalidationsLog.value.indexOf( |
58 'Invalidations service state changed to '+ | 58 'Invalidations service state changed to '+ |
59 '"TRANSIENT_INVALIDATION_ERROR"') != -1; | 59 '"TRANSIENT_INVALIDATION_ERROR"') != -1; |
60 expectTrue(isContained, 'Actual log is:' + invalidationsLog.value); | 60 expectTrue(isContained, 'Actual log is:' + invalidationsLog.value); |
61 }); | 61 }); |
62 | 62 |
| 63 // Test that objects ids appear on the table. |
| 64 TEST_F('InvalidationsWebUITest', 'testRegisteringNewIds', function() { |
| 65 var newDataType = [ |
| 66 { name: 'EXTENSIONS', source: 1004}, |
| 67 { name: 'FAVICON_IMAGE', source: 1004}, |
| 68 ]; |
| 69 var pattern1 = ['Fake', '1004', 'EXTENSIONS', '0', '', '', '']; |
| 70 var pattern2 = ['Fake', '1004', 'FAVICON_IMAGE', '0', '', '', '']; |
| 71 chrome.invalidations.updateIds("Fake", newDataType); |
| 72 var oidTable = $('objectsid-table-container'); |
| 73 expectEquals(3, oidTable.rows.length); |
| 74 expectEquals('header', oidTable.rows[0].className); |
| 75 expectEquals('content', oidTable.rows[1].className); |
| 76 expectEquals('content', oidTable.rows[2].className); |
| 77 expectEquals(7, oidTable.rows[1].cells.length); |
| 78 expectEquals(7, oidTable.rows[2].cells.length); |
| 79 |
| 80 // Row 0 is headers. |
| 81 for (var j = 0; j < oidTable.rows[1].cells.length; j++) { |
| 82 var cellContent = oidTable.rows[1].cells[j].textContent; |
| 83 expectEquals(pattern1[j], cellContent); |
| 84 } |
| 85 for (var j = 0; j < oidTable.rows[2].cells.length; j++) { |
| 86 var cellContent = oidTable.rows[2].cells[j].textContent; |
| 87 expectEquals(pattern2[j], cellContent); |
| 88 } |
| 89 newDataType = [{ name: 'FAVICON_IMAGE', source: 1004}]; |
| 90 chrome.invalidations.updateIds("Fake", newDataType); |
| 91 expectEquals('header', oidTable.rows[0].className); |
| 92 expectEquals('greyed', oidTable.rows[1].className); |
| 93 expectEquals('content', oidTable.rows[2].className); |
| 94 }); |
OLD | NEW |