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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 r.response_headers['Content-Type'] = 'image/gif' | 183 r.response_headers['Content-Type'] = 'image/gif' |
184 graph = self.MakeGraph(requests) | 184 graph = self.MakeGraph(requests) |
185 self.assertEqual(self.SuccessorIndicies(graph._nodes[0]), [1, 2, 3]) | 185 self.assertEqual(self.SuccessorIndicies(graph._nodes[0]), [1, 2, 3]) |
186 self.assertEqual(self.SuccessorIndicies(graph._nodes[1]), []) | 186 self.assertEqual(self.SuccessorIndicies(graph._nodes[1]), []) |
187 self.assertEqual(self.SuccessorIndicies(graph._nodes[2]), [4, 5]) | 187 self.assertEqual(self.SuccessorIndicies(graph._nodes[2]), [4, 5]) |
188 self.assertEqual(self.SuccessorIndicies(graph._nodes[3]), []) | 188 self.assertEqual(self.SuccessorIndicies(graph._nodes[3]), []) |
189 self.assertEqual(self.SuccessorIndicies(graph._nodes[4]), []) | 189 self.assertEqual(self.SuccessorIndicies(graph._nodes[4]), []) |
190 self.assertEqual(self.SuccessorIndicies(graph._nodes[5]), []) | 190 self.assertEqual(self.SuccessorIndicies(graph._nodes[5]), []) |
191 self.assertEqual(self.SortedIndicies(graph), [0, 1, 2, 3, 4, 5]) | 191 self.assertEqual(self.SortedIndicies(graph), [0, 1, 2, 3, 4, 5]) |
192 | 192 |
193 def test_AdUrl(self): | |
194 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( | |
195 'http://afae61024b33032ef.profile.sfo20.cloudfront.net/test.png')) | |
196 self.assertFalse(loading_model.ResourceGraph._IsAdUrl( | |
197 'http://afae61024b33032ef.profile.sfo20.cloudfront.net/tst.png')) | |
198 | |
199 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( | |
200 'http://ums.adtechus.com/mapuser?providerid=1003;' | |
201 'userid=RUmecco4z3o====')) | |
202 self.assertTrue(loading_model.ResourceGraph._IsAdUrl( | |
203 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')) | |
204 | |
205 | 193 |
206 if __name__ == '__main__': | 194 if __name__ == '__main__': |
207 unittest.main() | 195 unittest.main() |
OLD | NEW |