| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 package ninjalog | 5 package ninjalog |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "reflect" | 8 "reflect" |
| 9 "testing" | 9 "testing" |
| 10 "time" | 10 "time" |
| 11 ) | 11 ) |
| 12 | 12 |
| 13 func TestTrace(t *testing.T) { | 13 func TestTrace(t *testing.T) { |
| 14 flow := [][]Step{ | 14 flow := [][]Step{ |
| 15 []Step{ | 15 []Step{ |
| 16 Step{ | 16 Step{ |
| 17 Start: 76 * time.Millisecond, | 17 Start: 76 * time.Millisecond, |
| 18 End: 187 * time.Millisecond, | 18 End: 187 * time.Millisecond, |
| 19 Restat: time.Unix(0, 0), | |
| 20 Out: "resources/inspector/devtools_extension
_api.js", | 19 Out: "resources/inspector/devtools_extension
_api.js", |
| 21 CmdHash: "75430546595be7c2", | 20 CmdHash: "75430546595be7c2", |
| 22 }, | 21 }, |
| 23 Step{ | 22 Step{ |
| 24 Start: 187 * time.Millisecond, | 23 Start: 187 * time.Millisecond, |
| 25 End: 21304 * time.Millisecond, | 24 End: 21304 * time.Millisecond, |
| 26 Restat: time.Unix(0, 0), | |
| 27 Out: "obj/third_party/pdfium/core/src/fpdfdo
c/fpdfdoc.doc_formfield.o", | 25 Out: "obj/third_party/pdfium/core/src/fpdfdo
c/fpdfdoc.doc_formfield.o", |
| 28 CmdHash: "2ac7111aa1ae86af", | 26 CmdHash: "2ac7111aa1ae86af", |
| 29 }, | 27 }, |
| 30 }, | 28 }, |
| 31 []Step{ | 29 []Step{ |
| 32 Step{ | 30 Step{ |
| 33 Start: 78 * time.Millisecond, | 31 Start: 78 * time.Millisecond, |
| 34 End: 286 * time.Millisecond, | 32 End: 286 * time.Millisecond, |
| 35 Restat: time.Unix(0, 0), | |
| 36 Out: "gen/angle/commit_id.py", | 33 Out: "gen/angle/commit_id.py", |
| 37 CmdHash: "4ede38e2c1617d8c", | 34 CmdHash: "4ede38e2c1617d8c", |
| 38 }, | 35 }, |
| 39 Step{ | 36 Step{ |
| 40 Start: 287 * time.Millisecond, | 37 Start: 287 * time.Millisecond, |
| 41 End: 290 * time.Millisecond, | 38 End: 290 * time.Millisecond, |
| 42 Restat: time.Unix(0, 0), | |
| 43 Out: "obj/third_party/angle/src/copy_scripts
.actions_rules_copies.stamp", | 39 Out: "obj/third_party/angle/src/copy_scripts
.actions_rules_copies.stamp", |
| 44 CmdHash: "b211d373de72f455", | 40 CmdHash: "b211d373de72f455", |
| 45 }, | 41 }, |
| 46 }, | 42 }, |
| 47 []Step{ | 43 []Step{ |
| 48 Step{ | 44 Step{ |
| 49 Start: 79 * time.Millisecond, | 45 Start: 79 * time.Millisecond, |
| 50 End: 287 * time.Millisecond, | 46 End: 287 * time.Millisecond, |
| 51 Restat: time.Unix(0, 0), | |
| 52 Out: "gen/angle/copy_compiler_dll.bat", | 47 Out: "gen/angle/copy_compiler_dll.bat", |
| 53 CmdHash: "9fb635ad5d2c1109", | 48 CmdHash: "9fb635ad5d2c1109", |
| 54 }, | 49 }, |
| 55 }, | 50 }, |
| 56 []Step{ | 51 []Step{ |
| 57 Step{ | 52 Step{ |
| 58 Start: 80 * time.Millisecond, | 53 Start: 80 * time.Millisecond, |
| 59 End: 284 * time.Millisecond, | 54 End: 284 * time.Millisecond, |
| 60 Restat: time.Unix(0, 0), | |
| 61 Out: "gen/autofill_regex_constants.cc", | 55 Out: "gen/autofill_regex_constants.cc", |
| 62 CmdHash: "fa33c8d7ce1d8791", | 56 CmdHash: "fa33c8d7ce1d8791", |
| 63 }, | 57 }, |
| 64 }, | 58 }, |
| 65 []Step{ | 59 []Step{ |
| 66 Step{ | 60 Step{ |
| 67 Start: 141 * time.Millisecond, | 61 Start: 141 * time.Millisecond, |
| 68 End: 287 * time.Millisecond, | 62 End: 287 * time.Millisecond, |
| 69 Restat: time.Unix(0, 0), | |
| 70 Out: "PepperFlash/manifest.json", | 63 Out: "PepperFlash/manifest.json", |
| 71 CmdHash: "324f0a0b77c37ef", | 64 CmdHash: "324f0a0b77c37ef", |
| 72 }, | 65 }, |
| 73 }, | 66 }, |
| 74 []Step{ | 67 []Step{ |
| 75 Step{ | 68 Step{ |
| 76 Start: 142 * time.Millisecond, | 69 Start: 142 * time.Millisecond, |
| 77 End: 288 * time.Millisecond, | 70 End: 288 * time.Millisecond, |
| 78 Restat: time.Unix(0, 0), | |
| 79 Out: "PepperFlash/libpepflashplayer.so", | 71 Out: "PepperFlash/libpepflashplayer.so", |
| 80 CmdHash: "1e2c2b7845a4d4fe", | 72 CmdHash: "1e2c2b7845a4d4fe", |
| 81 }, | 73 }, |
| 82 }, | 74 }, |
| 83 } | 75 } |
| 84 | 76 |
| 85 traces := ToTraces(flow, 1) | 77 traces := ToTraces(flow, 1) |
| 86 want := []Trace{ | 78 want := []Trace{ |
| 87 Trace{ | 79 Trace{ |
| 88 Name: "resources/inspector/devtools_extension_api.j
s", | 80 Name: "resources/inspector/devtools_extension_api.j
s", |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 ProcessID: 1, | 155 ProcessID: 1, |
| 164 ThreadID: 1, | 156 ThreadID: 1, |
| 165 Args: map[string]interface{}{}, | 157 Args: map[string]interface{}{}, |
| 166 }, | 158 }, |
| 167 } | 159 } |
| 168 | 160 |
| 169 if !reflect.DeepEqual(traces, want) { | 161 if !reflect.DeepEqual(traces, want) { |
| 170 t.Errorf("ToTrace()=%v; want=%v", traces, want) | 162 t.Errorf("ToTrace()=%v; want=%v", traces, want) |
| 171 } | 163 } |
| 172 } | 164 } |
| OLD | NEW |