示例#1
0
def _ReadChartJsonValue(request):
  arguments = {}

  chart = request.get('chart')
  if not chart:
    return {}, None
  arguments['chart'] = chart

  tir_label = request.get('tir_label')
  if tir_label:
    arguments['tir_label'] = tir_label

  trace = request.get('trace')
  if trace:
    arguments['trace'] = trace

  return arguments, quest_module.ReadChartJsonValue(chart, tir_label, trace)
  def testMinimumArguments(self):
    arguments = {
        'configuration': 'chromium-rel-mac11-pro',
        'target': 'telemetry_perf_tests',
        'dimensions': '{}',
        'benchmark': 'speedometer',
        'browser': 'release',
        'chart': 'timeToFirst',
    }

    expected_quests = [
        quest.FindIsolate('chromium-rel-mac11-pro', 'telemetry_perf_tests'),
        quest.RunTest({}, _MIN_TELEMETRY_RUN_TEST_ARGUMENTS),
        quest.ReadChartJsonValue('timeToFirst', None, None),
    ]
    self.assertEqual(quest_generator.GenerateQuests(arguments),
                     (arguments, expected_quests))
  def testAllArguments(self):
    arguments = {
        'configuration': 'chromium-rel-mac11-pro',
        'target': 'telemetry_perf_tests',
        'dimensions': '{"key": "value"}',
        'benchmark': 'speedometer',
        'browser': 'release',
        'story': 'http://www.fifa.com/',
        'tir_label': 'pcv1-cold',
        'chart': 'timeToFirst',
        'trace': 'trace_name',
    }

    expected_quests = [
        quest.FindIsolate('chromium-rel-mac11-pro', 'telemetry_perf_tests'),
        quest.RunTest({'key': 'value'}, _ALL_TELEMETRY_RUN_TEST_ARGUMENTS),
        quest.ReadChartJsonValue('timeToFirst', 'pcv1-cold', 'trace_name'),
    ]
    self.assertEqual(quest_generator.GenerateQuests(arguments),
                     (arguments, expected_quests))