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 /** | 5 /** |
6 * @fileoverview The way these tests work is as follows: | 6 * @fileoverview The way these tests work is as follows: |
7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then | 7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then |
8 * calls the entry point for a test with RunJavascriptTest. The called | 8 * calls the entry point for a test with RunJavascriptTest. The called |
9 * function can then use the assert/expect functions defined in test_api.js. | 9 * function can then use the assert/expect functions defined in test_api.js. |
10 * All callbacks from the browser are wrapped in such a way that they can | 10 * All callbacks from the browser are wrapped in such a way that they can |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 export: ExportView.TAB_HANDLE_ID, | 234 export: ExportView.TAB_HANDLE_ID, |
235 import: ImportView.TAB_HANDLE_ID, | 235 import: ImportView.TAB_HANDLE_ID, |
236 proxy: ProxyView.TAB_HANDLE_ID, | 236 proxy: ProxyView.TAB_HANDLE_ID, |
237 events: EventsView.TAB_HANDLE_ID, | 237 events: EventsView.TAB_HANDLE_ID, |
238 timeline: TimelineView.TAB_HANDLE_ID, | 238 timeline: TimelineView.TAB_HANDLE_ID, |
239 dns: DnsView.TAB_HANDLE_ID, | 239 dns: DnsView.TAB_HANDLE_ID, |
240 sockets: SocketsView.TAB_HANDLE_ID, | 240 sockets: SocketsView.TAB_HANDLE_ID, |
241 spdy: SpdyView.TAB_HANDLE_ID, | 241 spdy: SpdyView.TAB_HANDLE_ID, |
242 httpPipeline: HttpPipelineView.TAB_HANDLE_ID, | 242 httpPipeline: HttpPipelineView.TAB_HANDLE_ID, |
243 httpCache: HttpCacheView.TAB_HANDLE_ID, | 243 httpCache: HttpCacheView.TAB_HANDLE_ID, |
244 httpThrottling: HttpThrottlingView.TAB_HANDLE_ID, | |
245 serviceProviders: ServiceProvidersView.TAB_HANDLE_ID, | 244 serviceProviders: ServiceProvidersView.TAB_HANDLE_ID, |
246 tests: TestView.TAB_HANDLE_ID, | 245 tests: TestView.TAB_HANDLE_ID, |
247 hsts: HSTSView.TAB_HANDLE_ID, | 246 hsts: HSTSView.TAB_HANDLE_ID, |
248 logs: LogsView.TAB_HANDLE_ID, | 247 logs: LogsView.TAB_HANDLE_ID, |
249 prerender: PrerenderView.TAB_HANDLE_ID, | 248 prerender: PrerenderView.TAB_HANDLE_ID, |
250 chromeos: CrosView.TAB_HANDLE_ID | 249 chromeos: CrosView.TAB_HANDLE_ID |
251 }; | 250 }; |
252 | 251 |
253 assertEquals(typeof hashToTabHandleIdMap[hash], 'string', | 252 assertEquals(typeof hashToTabHandleIdMap[hash], 'string', |
254 'Invalid tab anchor: ' + hash); | 253 'Invalid tab anchor: ' + hash); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 384 |
386 if (this.tasks_.length > 0) { | 385 if (this.tasks_.length > 0) { |
387 var nextTask = this.tasks_.shift(); | 386 var nextTask = this.tasks_.shift(); |
388 nextTask.start.apply(nextTask, argArray); | 387 nextTask.start.apply(nextTask, argArray); |
389 } else { | 388 } else { |
390 this.isRunning_ = false; | 389 this.isRunning_ = false; |
391 if (this.endTestWhenDone_) | 390 if (this.endTestWhenDone_) |
392 testDone(); | 391 testDone(); |
393 } | 392 } |
394 } | 393 } |
395 } | 394 }; |
396 | 395 |
397 /** | 396 /** |
398 * A Task that can be added to a TaskQueue. A Task is started with a call to | 397 * A Task that can be added to a TaskQueue. A Task is started with a call to |
399 * the start function, and must call its own onTaskDone when complete. | 398 * the start function, and must call its own onTaskDone when complete. |
400 * @constructor | 399 * @constructor |
401 */ | 400 */ |
402 NetInternalsTest.Task = function() { | 401 NetInternalsTest.Task = function() { |
403 this.taskQueue_ = null; | 402 this.taskQueue_ = null; |
404 this.isDone_ = false; | 403 this.isDone_ = false; |
405 this.completeAsync_ = false; | 404 this.completeAsync_ = false; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 * @param {object}: params The event parameters. May be null. | 612 * @param {object}: params The event parameters. May be null. |
614 * @constructor | 613 * @constructor |
615 */ | 614 */ |
616 NetInternalsTest.Event = function(source, type, time, phase, params) { | 615 NetInternalsTest.Event = function(source, type, time, phase, params) { |
617 assertNotEquals(getKeyWithValue(LogEventType, type), '?'); | 616 assertNotEquals(getKeyWithValue(LogEventType, type), '?'); |
618 assertNotEquals(getKeyWithValue(LogEventPhase, phase), '?'); | 617 assertNotEquals(getKeyWithValue(LogEventPhase, phase), '?'); |
619 | 618 |
620 this.source = source; | 619 this.source = source; |
621 this.phase = phase; | 620 this.phase = phase; |
622 this.type = type; | 621 this.type = type; |
623 this.time = "" + time; | 622 this.time = '' + time; |
624 this.phase = phase; | 623 this.phase = phase; |
625 if (params) | 624 if (params) |
626 this.params = params; | 625 this.params = params; |
627 }; | 626 }; |
628 | 627 |
629 /** | 628 /** |
630 * Creates a new NetLog begin event. Parameters are the same as Event, | 629 * Creates a new NetLog begin event. Parameters are the same as Event, |
631 * except there's no |phase| argument. | 630 * except there's no |phase| argument. |
632 * @see Event | 631 * @see Event |
633 */ | 632 */ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 ]; | 670 ]; |
672 | 671 |
673 for (var i = 0; i < allIds.length; ++i) { | 672 for (var i = 0; i < allIds.length; ++i) { |
674 var curId = allIds[i]; | 673 var curId = allIds[i]; |
675 expectEquals(nodeId == curId, NetInternalsTest.nodeIsVisible($(curId))); | 674 expectEquals(nodeId == curId, NetInternalsTest.nodeIsVisible($(curId))); |
676 } | 675 } |
677 }; | 676 }; |
678 | 677 |
679 return NetInternalsTest; | 678 return NetInternalsTest; |
680 })(); | 679 })(); |
OLD | NEW |