| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Include test fixture. | 5 // Include test fixture. |
| 6 GEN_INCLUDE(['net_internals_test.js']); | 6 GEN_INCLUDE(['net_internals_test.js']); |
| 7 | 7 |
| 8 // Anonymous namespace | 8 // Anonymous namespace |
| 9 (function() { | 9 (function() { |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Checks the display on the DNS tab against the information it should be | 12 * Checks the display on the DNS tab against the information it should be |
| 13 * displaying. | 13 * displaying. |
| 14 * @param {object} hostResolverInfo Results from a host resolver info query. | 14 * @param {object} hostResolverInfo Results from a host resolver info query. |
| 15 */ | 15 */ |
| 16 function checkDisplay(hostResolverInfo) { | 16 function checkDisplay(hostResolverInfo) { |
| 17 var family = hostResolverInfo.default_address_family; | 17 var family = hostResolverInfo.default_address_family; |
| 18 expectEquals(getKeyWithValue(AddressFamily, family), | 18 expectEquals(getKeyWithValue(AddressFamily, family), |
| 19 $(DnsView.DEFAULT_FAMILY_SPAN_ID).innerText); | 19 $(DnsView.DEFAULT_FAMILY_SPAN_ID).innerText); |
| 20 expectEquals(family == AddressFamily.ADDRESS_FAMILY_IPV4, | 20 expectEquals(family == AddressFamily.ADDRESS_FAMILY_IPV4, |
| 21 NetInternalsTest.isDisplayed($(DnsView.IPV6_DISABLED_SPAN_ID))); | 21 NetInternalsTest.isDisplayed($(DnsView.IPV6_DISABLED_SPAN_ID))); |
| 22 | 22 |
| 23 expectEquals(hostResolverInfo.cache.capacity, | 23 expectEquals(hostResolverInfo.cache.capacity, |
| 24 parseInt($(DnsView.CAPACITY_SPAN_ID).innerText)); | 24 parseInt($(DnsView.CAPACITY_SPAN_ID).innerText)); |
| 25 expectEquals(hostResolverInfo.cache.ttl_success_ms, | |
| 26 parseInt($(DnsView.TTL_SUCCESS_SPAN_ID).innerText)); | |
| 27 expectEquals(hostResolverInfo.cache.ttl_failure_ms, | |
| 28 parseInt($(DnsView.TTL_FAILURE_SPAN_ID).innerText)); | |
| 29 | 25 |
| 30 var entries = hostResolverInfo.cache.entries; | 26 var entries = hostResolverInfo.cache.entries; |
| 31 | 27 |
| 32 // Don't check exact displayed values, to avoid any races, but make sure | 28 // Don't check exact displayed values, to avoid any races, but make sure |
| 33 // values are non-negative and have the correct sum. | 29 // values are non-negative and have the correct sum. |
| 34 var active = parseInt($(DnsView.ACTIVE_SPAN_ID).innerText); | 30 var active = parseInt($(DnsView.ACTIVE_SPAN_ID).innerText); |
| 35 var expired = parseInt($(DnsView.EXPIRED_SPAN_ID).innerText); | 31 var expired = parseInt($(DnsView.EXPIRED_SPAN_ID).innerText); |
| 36 expectLE(0, active); | 32 expectLE(0, active); |
| 37 expectLE(0, expired); | 33 expectLE(0, expired); |
| 38 expectEquals(entries.length, active + expired); | 34 expectEquals(entries.length, active + expired); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 var taskQueue = new NetInternalsTest.TaskQueue(true); | 276 var taskQueue = new NetInternalsTest.TaskQueue(true); |
| 281 taskQueue.addTask(new NetInternalsTest.CreateIncognitoBrowserTask()); | 277 taskQueue.addTask(new NetInternalsTest.CreateIncognitoBrowserTask()); |
| 282 taskQueue.addTask(new AddCacheEntryTask( | 278 taskQueue.addTask(new AddCacheEntryTask( |
| 283 'somewhere.com', '1.2.3.4', 0, true)); | 279 'somewhere.com', '1.2.3.4', 0, true)); |
| 284 taskQueue.addTask(NetInternalsTest.getCloseIncognitoBrowserTask()); | 280 taskQueue.addTask(NetInternalsTest.getCloseIncognitoBrowserTask()); |
| 285 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); | 281 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); |
| 286 taskQueue.run(true); | 282 taskQueue.run(true); |
| 287 }); | 283 }); |
| 288 | 284 |
| 289 })(); // Anonymous namespace | 285 })(); // Anonymous namespace |
| OLD | NEW |