1# Copyright 2014 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
5import json
6import sys
7
8from telemetry.web_components import web_component
9
10
11class ResultsViewer(web_component.WebComponent):
12  def __init__(self, data_to_view=None):
13    super(ResultsViewer, self).__init__(
14      tvcm_module_name='telemetry.web_components.results_viewer',
15      js_class_name='telemetry.web_components.ResultsViewer',
16      data_binding_property='dataToView')
17    self.data_to_view = data_to_view
18
19  def WriteDataToFileAsJson(self, f):
20    json.dump(self.data_to_view, f)
21
22
23if __name__ == '__main__':
24  x = ResultsViewer({'hello': 'world', 'nice': ['to', 'see', 'you']})
25  x.WriteWebComponentToFile(sys.stdout)
26