1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 from perf_tools
import memory_benchmark
5 from telemetry
.page
import page_benchmark_unittest_base
7 class MemoryBenchmarkUnitTest(
8 page_benchmark_unittest_base
.PageBenchmarkUnitTestBase
):
10 def testMemoryBenchmark(self
):
11 ps
= self
.CreatePageSetFromFileInUnittestDataDir('page_with_link.html')
12 ps
.pages
[0].stress_memory
= {'action': 'click_element', 'text': 'Click me'}
14 benchmark
= memory_benchmark
.MemoryBenchmark()
15 all_results
= self
.RunBenchmark(benchmark
, ps
)
17 self
.assertEqual(0, len(all_results
.page_failures
))
18 self
.assertEqual(1, len(all_results
.page_results
))
20 results0
= all_results
.page_results
[0]
21 expected_measurements
= ['V8.MemoryExternalFragmentationTotal',
22 'V8.MemoryHeapSampleTotalCommitted',
23 'V8.MemoryHeapSampleTotalUsed']
26 [m
in results0
.measurement_names
for m
in expected_measurements
]))