コード例 #1
0
 def testWriteBenchmarkMetadata(self):
     story = test_stories.DummyStory('story')
     with page_test_results.PageTestResults(
             benchmark_name='benchmark_name') as results:
         with results.CreateStoryRun(story):
             self.agent.StartAgentTracing(self.config, timeout=10)
             telemetry_tracing_agent.RecordBenchmarkMetadata(results)
             self.agent.StopAgentTracing()
             with trace_data.TraceDataBuilder() as builder:
                 self.agent.CollectAgentTraceData(builder)
                 trace = builder.AsData().GetTraceFor(
                     trace_data.TELEMETRY_PART)
     benchmarks = trace['metadata']['telemetry']['benchmarks']
     self.assertEqual(len(benchmarks), 1)
     self.assertEqual(benchmarks[0], 'benchmark_name')
コード例 #2
0
    def testWriteBenchmarkMetadata(self):
        results = page_test_results.PageTestResults(
            benchmark_name='benchmark', benchmark_description='desc')

        story = mock.Mock()
        story.name = 'story'
        story.GetStoryTagsList.return_value = ['tag1', 'tag2']
        results.WillRunPage(story)
        self.agent.StartAgentTracing(self.config, timeout=10)
        telemetry_tracing_agent.RecordBenchmarkMetadata(results)
        self.agent.StopAgentTracing()
        results.DidRunPage(story)

        with trace_data.TraceDataBuilder() as builder:
            self.agent.CollectAgentTraceData(builder)
            trace = builder.AsData().GetTraceFor(trace_data.TELEMETRY_PART)
        benchmarks = trace['metadata']['telemetry']['benchmarks']
        self.assertEqual(len(benchmarks), 1)
        self.assertEqual(benchmarks[0], 'benchmark')
コード例 #3
0
 def RecordBenchmarkMetadata(self, results):
   """Write benchmark metadata into the trace being currently recorded."""
   telemetry_tracing_agent.RecordBenchmarkMetadata(results)