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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 def SuccessorIndicies(self, node): | 65 def SuccessorIndicies(self, node): |
66 return [c.Index() for c in node.SortedSuccessors()] | 66 return [c.Index() for c in node.SortedSuccessors()] |
67 | 67 |
68 def test_DictConstruction(self): | 68 def test_DictConstruction(self): |
69 graph = loading_model.ResourceGraph( | 69 graph = loading_model.ResourceGraph( |
70 {'request_track': { | 70 {'request_track': { |
71 'events': [self.MakeParserRequest(0, 'null', 100, 101).ToJsonDict(), | 71 'events': [self.MakeParserRequest(0, 'null', 100, 101).ToJsonDict(), |
72 self.MakeParserRequest(1, 0, 102, 103).ToJsonDict(), | 72 self.MakeParserRequest(1, 0, 102, 103).ToJsonDict(), |
73 self.MakeParserRequest(2, 0, 102, 103).ToJsonDict(), | 73 self.MakeParserRequest(2, 0, 102, 103).ToJsonDict(), |
74 self.MakeParserRequest(3, 2, 104, 105).ToJsonDict()], | 74 self.MakeParserRequest(3, 2, 104, 105).ToJsonDict()], |
75 'metadata': { 'duplicates_count' : 0 }}, | 75 'metadata': { |
| 76 request_track.RequestTrack._DUPLICATES_KEY: 0, |
| 77 request_track.RequestTrack._INCONSISTENT_INITIATORS_KEY: 0}}, |
76 'url': 'foo.com', | 78 'url': 'foo.com', |
77 'tracing_track': {'events': []}, | 79 'tracing_track': {'events': []}, |
78 'page_track': {'events': []}, | 80 'page_track': {'events': []}, |
79 'metadata': {}}) | 81 'metadata': {}}) |
80 self.assertEqual(self.SuccessorIndicies(graph._nodes[0]), [1, 2]) | 82 self.assertEqual(self.SuccessorIndicies(graph._nodes[0]), [1, 2]) |
81 self.assertEqual(self.SuccessorIndicies(graph._nodes[1]), []) | 83 self.assertEqual(self.SuccessorIndicies(graph._nodes[1]), []) |
82 self.assertEqual(self.SuccessorIndicies(graph._nodes[2]), [3]) | 84 self.assertEqual(self.SuccessorIndicies(graph._nodes[2]), [3]) |
83 self.assertEqual(self.SuccessorIndicies(graph._nodes[3]), []) | 85 self.assertEqual(self.SuccessorIndicies(graph._nodes[3]), []) |
84 | 86 |
85 def test_Costing(self): | 87 def test_Costing(self): |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 200 |
199 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( | 201 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( |
200 'http://ums.adtechus.com/mapuser?providerid=1003;' | 202 'http://ums.adtechus.com/mapuser?providerid=1003;' |
201 'userid=RUmecco4z3o====')) | 203 'userid=RUmecco4z3o====')) |
202 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( | 204 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( |
203 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')) | 205 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')) |
204 | 206 |
205 | 207 |
206 if __name__ == '__main__': | 208 if __name__ == '__main__': |
207 unittest.main() | 209 unittest.main() |
OLD | NEW |