1 # Copyright 2012 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.
5 from metrics
import memory
6 from metrics
import power
7 from telemetry
.page
import page_test
9 class Memory(page_test
.PageTest
):
11 super(Memory
, self
).__init
__('RunStressMemory')
12 self
._memory
_metric
= None
13 self
._power
_metric
= None
15 def WillStartBrowser(self
, platform
):
16 self
._power
_metric
= power
.PowerMetric(platform
)
18 def DidStartBrowser(self
, browser
):
19 self
._memory
_metric
= memory
.MemoryMetric(browser
)
21 def DidNavigateToPage(self
, page
, tab
):
22 self
._memory
_metric
.Start(page
, tab
)
23 self
._power
_metric
.Start(page
, tab
)
25 def CustomizeBrowserOptions(self
, options
):
26 memory
.MemoryMetric
.CustomizeBrowserOptions(options
)
27 # Since this is a memory benchmark, we want to sample memory histograms at
29 options
.AppendExtraBrowserArgs('--memory-metrics')
31 def ValidateAndMeasurePage(self
, page
, tab
, results
):
32 self
._power
_metric
.Stop(page
, tab
)
33 self
._memory
_metric
.Stop(page
, tab
)
34 self
._memory
_metric
.AddResults(tab
, results
)
35 self
._power
_metric
.AddResults(tab
, results
)