OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import os | 5 import os |
6 import sys | 6 import sys |
7 import unittest | 7 import unittest |
8 | 8 |
9 import dag | 9 import dag |
10 import loading_model | 10 import loading_model |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 def SuccessorIndicies(self, node): | 72 def SuccessorIndicies(self, node): |
73 return [c.Index() for c in node.SortedSuccessors()] | 73 return [c.Index() for c in node.SortedSuccessors()] |
74 | 74 |
75 def test_DictConstruction(self): | 75 def test_DictConstruction(self): |
76 graph = loading_model.ResourceGraph( | 76 graph = loading_model.ResourceGraph( |
77 {'request_track': { | 77 {'request_track': { |
78 'events': [self.MakeParserRequest(0, 'null', 100, 101).ToJsonDict(), | 78 'events': [self.MakeParserRequest(0, 'null', 100, 101).ToJsonDict(), |
79 self.MakeParserRequest(1, 0, 102, 103).ToJsonDict(), | 79 self.MakeParserRequest(1, 0, 102, 103).ToJsonDict(), |
80 self.MakeParserRequest(2, 0, 102, 103).ToJsonDict(), | 80 self.MakeParserRequest(2, 0, 102, 103).ToJsonDict(), |
81 self.MakeParserRequest(3, 2, 104, 105).ToJsonDict()], | 81 self.MakeParserRequest(3, 2, 104, 105).ToJsonDict()], |
82 'metadata': { 'duplicates_count' : 0 }}, | 82 'metadata': { |
| 83 request_track.RequestTrack._DUPLICATES_KEY: 0, |
| 84 request_track.RequestTrack._INCONSISTENT_INITIATORS_KEY: 0}}, |
83 'url': 'foo.com', | 85 'url': 'foo.com', |
84 'tracing_track': {'events': []}, | 86 'tracing_track': {'events': []}, |
85 'page_track': {'events': []}, | 87 'page_track': {'events': []}, |
86 'metadata': {}}) | 88 'metadata': {}}) |
87 self.assertEqual(self.SuccessorIndicies(graph._nodes[0]), [1, 2]) | 89 self.assertEqual(self.SuccessorIndicies(graph._nodes[0]), [1, 2]) |
88 self.assertEqual(self.SuccessorIndicies(graph._nodes[1]), []) | 90 self.assertEqual(self.SuccessorIndicies(graph._nodes[1]), []) |
89 self.assertEqual(self.SuccessorIndicies(graph._nodes[2]), [3]) | 91 self.assertEqual(self.SuccessorIndicies(graph._nodes[2]), [3]) |
90 self.assertEqual(self.SuccessorIndicies(graph._nodes[3]), []) | 92 self.assertEqual(self.SuccessorIndicies(graph._nodes[3]), []) |
91 | 93 |
92 def test_Costing(self): | 94 def test_Costing(self): |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 207 |
206 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( | 208 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( |
207 'http://ums.adtechus.com/mapuser?providerid=1003;' | 209 'http://ums.adtechus.com/mapuser?providerid=1003;' |
208 'userid=RUmecco4z3o====')) | 210 'userid=RUmecco4z3o====')) |
209 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( | 211 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( |
210 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')) | 212 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')) |
211 | 213 |
212 | 214 |
213 if __name__ == '__main__': | 215 if __name__ == '__main__': |
214 unittest.main() | 216 unittest.main() |
OLD | NEW |