| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import base64 | 5 import base64 |
| 6 import json | 6 import json |
| 7 import urlparse | 7 import urlparse |
| 8 import webapp2 | 8 import webapp2 |
| 9 import webtest | 9 import webtest |
| 10 | 10 |
| 11 from dashboard import add_histograms | 11 from dashboard import add_histograms |
| 12 from dashboard.common import testing_common | 12 from dashboard.common import testing_common |
| 13 from tracing.value import histogram as histogram_module | 13 from tracing.value import histogram as histogram_module |
| 14 | 14 |
| 15 | 15 |
| 16 class AddHistogramsTest(testing_common.TestCase): | 16 class AddHistogramsTest(testing_common.TestCase): |
| 17 def setUp(self): | 17 def setUp(self): |
| 18 super(AddHistogramsTest, self).setUp() | 18 super(AddHistogramsTest, self).setUp() |
| 19 app = webapp2.WSGIApplication([ | 19 app = webapp2.WSGIApplication([ |
| 20 ('/add_histograms', add_histograms.AddHistogramsHandler)]) | 20 ('/add_histograms', add_histograms.AddHistogramsHandler)]) |
| 21 self.testapp = webtest.TestApp(app) | 21 self.testapp = webtest.TestApp(app) |
| 22 testing_common.SetIsInternalUser('foo@bar.com', True) | 22 testing_common.SetIsInternalUser('foo@bar.com', True) |
| 23 self.SetCurrentUser('foo@bar.com', is_admin=True) | 23 self.SetCurrentUser('foo@bar.com', is_admin=True) |
| 24 | 24 |
| 25 def testPostSetsTestPathAndRevision(self): | 25 def testPostHistogramSetsTestPathAndRevision(self): |
| 26 data = json.dumps([ | 26 data = json.dumps([ |
| 27 { | 27 { |
| 28 'benchmarkName': 'benchmark', | 28 'benchmarkName': 'benchmark', |
| 29 'canonicalUrl': '', | 29 'canonicalUrl': '', |
| 30 'guid': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae', | 30 'guid': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae', |
| 31 'label': '', | 31 'label': '', |
| 32 'legacyTIRLabel': '', | 32 'legacyTIRLabel': '', |
| 33 'storyDisplayName': 'story', | 33 'storyDisplayName': 'story', |
| 34 'type': 'TelemetryInfo' | 34 'type': 'TelemetryInfo' |
| 35 }, { | 35 }, { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 histograms.AddSharedDiagnostic('foo', histogram_module.BuildbotInfo({ | 152 histograms.AddSharedDiagnostic('foo', histogram_module.BuildbotInfo({ |
| 153 'displayMasterName': 'dmn', | 153 'displayMasterName': 'dmn', |
| 154 'displayBotName': 'dbn', | 154 'displayBotName': 'dbn', |
| 155 'buildbotMasterName': 'bbmn', | 155 'buildbotMasterName': 'bbmn', |
| 156 'buildbotName': 'bbn', | 156 'buildbotName': 'bbn', |
| 157 'buildNumber': 42, | 157 'buildNumber': 42, |
| 158 'logUri': 'uri', | 158 'logUri': 'uri', |
| 159 })) | 159 })) |
| 160 add_histograms.InlineDenseSharedDiagnostics(histograms) | 160 add_histograms.InlineDenseSharedDiagnostics(histograms) |
| 161 self.assertFalse(histogram.diagnostics['foo'].is_inline) | 161 self.assertFalse(histogram.diagnostics['foo'].is_inline) |
| OLD | NEW |