Esempio n. 1
0
    def testForParsingOldFormat(self):
        def getMetric(results, name):
            metrics = results.FindAllPageSpecificValuesNamed(name)
            self.assertEquals(1, len(metrics))
            return metrics[0].values

        data = self._GenerateDataForParsingOldFormat()

        measurement = oilpan_gc_times._OilpanGCTimesBase()

        tab = mock.MagicMock()
        with mock.patch('contrib.oilpan.oilpan_gc_times.TimelineModel'
                        ) as MockTimelineModel:
            MockTimelineModel.return_value = data._model
            measurement.ValidateAndMeasurePage(None, tab, data.results)

        results = data.results
        self.assertEquals(3, len(getMetric(results, 'oilpan_precise_mark')))
        self.assertEquals(3,
                          len(getMetric(results, 'oilpan_precise_lazy_sweep')))
        self.assertEquals(
            3, len(getMetric(results, 'oilpan_precise_complete_sweep')))
        self.assertEquals(1, len(getMetric(results,
                                           'oilpan_conservative_mark')))
        self.assertEquals(
            1, len(getMetric(results, 'oilpan_conservative_lazy_sweep')))
        self.assertEquals(
            1, len(getMetric(results, 'oilpan_conservative_complete_sweep')))
        self.assertEquals(2, len(getMetric(results, 'oilpan_forced_mark')))
        self.assertEquals(2, len(getMetric(results,
                                           'oilpan_forced_lazy_sweep')))
        self.assertEquals(
            2, len(getMetric(results, 'oilpan_forced_complete_sweep')))
Esempio n. 2
0
 def RunMeasurement(self):
     # pylint: disable=protected-access
     measurement = oilpan_gc_times._OilpanGCTimesBase()
     results = page_test_results.PageTestResults()
     tab = mock.MagicMock()
     with mock.patch('contrib.oilpan.oilpan_gc_times.TimelineModel'
                     ) as MockTimelineModel:
         MockTimelineModel.return_value = self._model
         results.WillRunPage(self._page)
         try:
             measurement.ValidateAndMeasurePage(self._page, tab, results)
         finally:
             results.DidRunPage(self._page)
     return results