| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import sys |
| 8 import unittest |
| 9 |
| 10 sys.path.insert(0, os.path.dirname(__file__)) |
| 11 import symbolize_trace_atos_regex |
| 12 |
| 13 |
| 14 class AtosRegexTest(unittest.TestCase): |
| 15 def testRegex(self): |
| 16 if sys.platform != "darwin": |
| 17 return |
| 18 matcher = symbolize_trace_atos_regex.AtosRegexMatcher() |
| 19 text = "-[SKTGraphicView drawRect:] (in Sketch) (SKTGraphicView.m:445)" |
| 20 output = matcher.Match(text) |
| 21 self.assertEqual("-[SKTGraphicView drawRect:]", output) |
| 22 |
| 23 text = "malloc (in libsystem_malloc.dylib) + 42" |
| 24 output = matcher.Match(text) |
| 25 self.assertEqual("malloc", output) |
| 26 |
| 27 expected_output = ( |
| 28 "content::CacheStorage::MatchAllCaches(std::__1::unique_ptr<content::Se" |
| 29 "rviceWorkerFetchRequest, std::__1::default_delete<content::ServiceWork" |
| 30 "erFetchRequest> >, content::CacheStorageCacheQueryParams const&, base:" |
| 31 ":Callback<void (content::CacheStorageError, std::__1::unique_ptr<conte" |
| 32 "nt::ServiceWorkerResponse, std::__1::default_delete<content::ServiceWo" |
| 33 "rkerResponse> >, std::__1::unique_ptr<storage::BlobDataHandle, std::__" |
| 34 "1::default_delete<storage::BlobDataHandle> >), (base::internal::CopyMo" |
| 35 "de)1, (base::internal::RepeatMode)1> const&)" |
| 36 ) |
| 37 text = expected_output + " (in Chromium Framework) (ref_counted.h:322)" |
| 38 output = matcher.Match(text) |
| 39 self.assertEqual(expected_output, output) |
| 40 |
| 41 text = "0x4a12" |
| 42 output = matcher.Match(text) |
| 43 self.assertEqual(text, output) |
| 44 |
| 45 text = "0x00000d9a (in Chromium)" |
| 46 output = matcher.Match(text) |
| 47 self.assertEqual(text, output) |
| 48 |
| 49 |
| 50 if __name__ == '__main__': |
| 51 unittest.main() |
| OLD | NEW |