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 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 }; | 209 }; |
210 | 210 |
211 /** | 211 /** |
212 * Adds a successful lookup to the DNS cache, then clears the cache. | 212 * Adds a successful lookup to the DNS cache, then clears the cache. |
213 */ | 213 */ |
214 TEST_F('NetInternalsTest', 'netInternalsDnsViewSuccess', function() { | 214 TEST_F('NetInternalsTest', 'netInternalsDnsViewSuccess', function() { |
215 NetInternalsTest.switchToView('dns'); | 215 NetInternalsTest.switchToView('dns'); |
216 var taskQueue = new NetInternalsTest.TaskQueue(true); | 216 var taskQueue = new NetInternalsTest.TaskQueue(true); |
217 taskQueue.addTask(new AddCacheEntryTask( | 217 taskQueue.addTask(new AddCacheEntryTask( |
218 'somewhere.com', '1.2.3.4', 0, false)); | 218 'somewhere.com', '1.2.3.4', 0, false)); |
219 taskQueue.addTask(new ClearCacheTask()); | 219 taskQueue.addTask(new ClearCacheTask()); |
220 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); | 220 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); |
221 taskQueue.run(true); | 221 taskQueue.run(true); |
222 }); | 222 }); |
223 | 223 |
224 /** | 224 /** |
225 * Adds a failed lookup to the DNS cache, then clears the cache. | 225 * Adds a failed lookup to the DNS cache, then clears the cache. |
226 */ | 226 */ |
227 TEST_F('NetInternalsTest', 'netInternalsDnsViewFail', function() { | 227 TEST_F('NetInternalsTest', 'netInternalsDnsViewFail', function() { |
228 NetInternalsTest.switchToView('dns'); | 228 NetInternalsTest.switchToView('dns'); |
229 var taskQueue = new NetInternalsTest.TaskQueue(true); | 229 var taskQueue = new NetInternalsTest.TaskQueue(true); |
230 taskQueue.addTask(new AddCacheEntryTask( | 230 taskQueue.addTask(new AddCacheEntryTask( |
231 'nowhere.com', '', NetError.NAME_NOT_RESOLVED, false)); | 231 'nowhere.com', '', NetError.ERR_NAME_NOT_RESOLVED, false)); |
232 taskQueue.addTask(new ClearCacheTask()); | 232 taskQueue.addTask(new ClearCacheTask()); |
233 taskQueue.addTask(new WaitForEntryDestructionTask('nowhere.com')); | 233 taskQueue.addTask(new WaitForEntryDestructionTask('nowhere.com')); |
234 taskQueue.run(true); | 234 taskQueue.run(true); |
235 }); | 235 }); |
236 | 236 |
237 /** | 237 /** |
238 * Adds an expired successful lookup to the DNS cache, then clears the cache. | 238 * Adds an expired successful lookup to the DNS cache, then clears the cache. |
239 */ | 239 */ |
240 TEST_F('NetInternalsTest', 'netInternalsDnsViewExpired', function() { | 240 TEST_F('NetInternalsTest', 'netInternalsDnsViewExpired', function() { |
241 NetInternalsTest.switchToView('dns'); | 241 NetInternalsTest.switchToView('dns'); |
242 var taskQueue = new NetInternalsTest.TaskQueue(true); | 242 var taskQueue = new NetInternalsTest.TaskQueue(true); |
243 taskQueue.addTask(new AddCacheEntryTask( | 243 taskQueue.addTask(new AddCacheEntryTask( |
244 'somewhere.com', '1.2.3.4', 0, true)); | 244 'somewhere.com', '1.2.3.4', 0, true)); |
245 taskQueue.addTask(new ClearCacheTask()); | 245 taskQueue.addTask(new ClearCacheTask()); |
246 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); | 246 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); |
247 taskQueue.run(true); | 247 taskQueue.run(true); |
248 }); | 248 }); |
249 | 249 |
250 /** | 250 /** |
251 * Adds two entries to the DNS cache, clears the cache, and then repeats. | 251 * Adds two entries to the DNS cache, clears the cache, and then repeats. |
252 */ | 252 */ |
253 TEST_F('NetInternalsTest', 'netInternalsDnsViewAddTwoTwice', function() { | 253 TEST_F('NetInternalsTest', 'netInternalsDnsViewAddTwoTwice', function() { |
254 NetInternalsTest.switchToView('dns'); | 254 NetInternalsTest.switchToView('dns'); |
255 var taskQueue = new NetInternalsTest.TaskQueue(true); | 255 var taskQueue = new NetInternalsTest.TaskQueue(true); |
256 for (var i = 0; i < 2; ++i) { | 256 for (var i = 0; i < 2; ++i) { |
257 taskQueue.addTask(new AddCacheEntryTask( | 257 taskQueue.addTask(new AddCacheEntryTask( |
258 'somewhere.com', '1.2.3.4', 0, false)); | 258 'somewhere.com', '1.2.3.4', 0, false)); |
259 taskQueue.addTask(new AddCacheEntryTask( | 259 taskQueue.addTask(new AddCacheEntryTask( |
260 'nowhere.com', '', NetError.NAME_NOT_RESOLVED, true)); | 260 'nowhere.com', '', NetError.ERR_NAME_NOT_RESOLVED, true)); |
261 taskQueue.addTask(new ClearCacheTask()); | 261 taskQueue.addTask(new ClearCacheTask()); |
262 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); | 262 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); |
263 taskQueue.addTask(new WaitForEntryDestructionTask('nowhere.com')); | 263 taskQueue.addTask(new WaitForEntryDestructionTask('nowhere.com')); |
264 } | 264 } |
265 taskQueue.run(true); | 265 taskQueue.run(true); |
266 }); | 266 }); |
267 | 267 |
268 /** | 268 /** |
269 * Makes sure that openning and then closing an incognito window clears the | 269 * Makes sure that openning and then closing an incognito window clears the |
270 * DNS cache. To keep things simple, we add a fake cache entry ourselves, | 270 * DNS cache. To keep things simple, we add a fake cache entry ourselves, |
271 * rather than having the incognito browser create one. | 271 * rather than having the incognito browser create one. |
272 */ | 272 */ |
273 TEST_F('NetInternalsTest', 'netInternalsDnsViewIncognitoClears', function() { | 273 TEST_F('NetInternalsTest', 'netInternalsDnsViewIncognitoClears', function() { |
274 NetInternalsTest.switchToView('dns'); | 274 NetInternalsTest.switchToView('dns'); |
275 var taskQueue = new NetInternalsTest.TaskQueue(true); | 275 var taskQueue = new NetInternalsTest.TaskQueue(true); |
276 taskQueue.addTask(new NetInternalsTest.CreateIncognitoBrowserTask()); | 276 taskQueue.addTask(new NetInternalsTest.CreateIncognitoBrowserTask()); |
277 taskQueue.addTask(new AddCacheEntryTask( | 277 taskQueue.addTask(new AddCacheEntryTask( |
278 'somewhere.com', '1.2.3.4', 0, true)); | 278 'somewhere.com', '1.2.3.4', 0, true)); |
279 taskQueue.addTask(NetInternalsTest.getCloseIncognitoBrowserTask()); | 279 taskQueue.addTask(NetInternalsTest.getCloseIncognitoBrowserTask()); |
280 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); | 280 taskQueue.addTask(new WaitForEntryDestructionTask('somewhere.com')); |
281 taskQueue.run(true); | 281 taskQueue.run(true); |
282 }); | 282 }); |
283 | 283 |
284 })(); // Anonymous namespace | 284 })(); // Anonymous namespace |
OLD | NEW |