| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import os | 4 import os |
| 5 import logging | 5 import logging |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 from telemetry.core import util | 8 from telemetry.core import util |
| 9 from telemetry.core.platform.profiler import perf_profiler | 9 from telemetry.core.platform.profiler import perf_profiler |
| 10 from telemetry.unittest import options_for_unittests | 10 from telemetry.unittest import options_for_unittests |
| 11 from telemetry.unittest import simple_mock | 11 from telemetry.unittest import simple_mock |
| 12 | 12 |
| 13 class TestPerfProfiler(unittest.TestCase): | 13 class TestPerfProfiler(unittest.TestCase): |
| 14 def testPerfProfiler(self): | 14 def testPerfProfiler(self): |
| 15 options = options_for_unittests.GetCopy() | 15 options = options_for_unittests.GetCopy() |
| 16 if not perf_profiler.PerfProfiler.is_supported(options): | 16 if not perf_profiler.PerfProfiler.is_supported(options.browser_type): |
| 17 logging.warning('PerfProfiler is not supported. Skipping test') | 17 logging.warning('PerfProfiler is not supported. Skipping test') |
| 18 return | 18 return |
| 19 | 19 |
| 20 profile_file = os.path.join( | 20 profile_file = os.path.join( |
| 21 util.GetUnittestDataDir(), 'perf_report_output.txt') | 21 util.GetUnittestDataDir(), 'perf_report_output.txt') |
| 22 perf_report_output = open(profile_file, 'r').read() | 22 perf_report_output = open(profile_file, 'r').read() |
| 23 | 23 |
| 24 mock_popen = simple_mock.MockObject() | 24 mock_popen = simple_mock.MockObject() |
| 25 mock_popen.ExpectCall('communicate').WillReturn([perf_report_output]) | 25 mock_popen.ExpectCall('communicate').WillReturn([perf_report_output]) |
| 26 | 26 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 'v8::internal::FlexibleBodyVisitor::Visit': 31909537, | 40 'v8::internal::FlexibleBodyVisitor::Visit': 31909537, |
| 41 'v8::internal::LiveRange::CreateAssignedOperand': 42913933, | 41 'v8::internal::LiveRange::CreateAssignedOperand': 42913933, |
| 42 'void v8::internal::RelocInfo::Visit': 96878864, | 42 'void v8::internal::RelocInfo::Visit': 96878864, |
| 43 'WebCore::HTMLTokenizer::nextToken': 48240439, | 43 'WebCore::HTMLTokenizer::nextToken': 48240439, |
| 44 'v8::internal::Scanner::ScanIdentifierOrKeyword': 46054550, | 44 'v8::internal::Scanner::ScanIdentifierOrKeyword': 46054550, |
| 45 'sk_memset32_SSE2': 45121317, | 45 'sk_memset32_SSE2': 45121317, |
| 46 'v8::internal::HeapObject::Size': 39786862 | 46 'v8::internal::HeapObject::Size': 39786862 |
| 47 }) | 47 }) |
| 48 finally: | 48 finally: |
| 49 perf_profiler.subprocess = real_subprocess | 49 perf_profiler.subprocess = real_subprocess |
| OLD | NEW |