OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <!-- | 3 <!-- |
4 Copyright (c) 2011 The Chromium Authors. All rights reserved. | 4 Copyright (c) 2011 The Chromium Authors. All rights reserved. |
5 Use of this source code is governed by a BSD-style license that can be | 5 Use of this source code is governed by a BSD-style license that can be |
6 found in the LICENSE file. | 6 found in the LICENSE file. |
7 --> | 7 --> |
8 <head> | 8 <head> |
9 <title>TraceEventImporter tests</title> | 9 <title>TraceEventImporter tests</title> |
10 <script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.j
s"></script> | 10 <script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.j
s"></script> |
11 <script src="../shared/js/cr.js"></script> | 11 <script src="../shared/js/cr.js"></script> |
12 <script src="../shared/js/cr/event_target.js"></script> | 12 <script src="../shared/js/cr/event_target.js"></script> |
13 <script src="test_utils.js"></script> | 13 <script src="test_utils.js"></script> |
14 <script src="timeline_model.js"></script> | 14 <script src="timeline_model.js"></script> |
15 <script src="trace_event_importer.js"></script> | 15 <script src="trace_event_importer.js"></script> |
16 <script> | 16 <script> |
17 goog.require('goog.testing.jsunit'); | 17 goog.require('goog.testing.jsunit'); |
18 </script> | 18 </script> |
19 | 19 |
20 </head> | 20 </head> |
21 <body> | 21 <body> |
22 <script> | 22 <script> |
23 | 23 |
| 24 function testCanImportEmpty() { |
| 25 self.assertFalse(tracing.TraceEventImporter.canImport([])); |
| 26 self.assertFalse(tracing.TraceEventImporter.canImport("")); |
| 27 } |
| 28 |
24 function testBasicSingleThreadNonnestedParsing() { | 29 function testBasicSingleThreadNonnestedParsing() { |
25 var events = [ | 30 var events = [ |
26 {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'}, | 31 {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'}, |
27 {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}, | 32 {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}, |
28 {name: 'b', args: {}, pid: 52, ts: 629, cat: 'foo', tid: 53, ph: 'B'}, | 33 {name: 'b', args: {}, pid: 52, ts: 629, cat: 'foo', tid: 53, ph: 'B'}, |
29 {name: 'b', args: {}, pid: 52, ts: 631, cat: 'foo', tid: 53, ph: 'E'} | 34 {name: 'b', args: {}, pid: 52, ts: 631, cat: 'foo', tid: 53, ph: 'E'} |
30 ]; | 35 ]; |
31 | 36 |
32 var m = new tracing.TimelineModel(events); | 37 var m = new tracing.TimelineModel(events); |
33 assertEquals(1, m.numProcesses); | 38 assertEquals(1, m.numProcesses); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 555 |
551 // Drop off the trailing ] and add a newline | 556 // Drop off the trailing ] and add a newline |
552 var dropped = tmp.substring(0, tmp.length - 1); | 557 var dropped = tmp.substring(0, tmp.length - 1); |
553 var m = new tracing.TimelineModel(dropped + '\n'); | 558 var m = new tracing.TimelineModel(dropped + '\n'); |
554 assertEquals(1, m.numProcesses); | 559 assertEquals(1, m.numProcesses); |
555 } | 560 } |
556 | 561 |
557 </script> | 562 </script> |
558 </body> | 563 </body> |
559 </html> | 564 </html> |
OLD | NEW |