OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import org.junit.rules.ExternalResource; | 7 import org.junit.rules.ExternalResource; |
8 | 8 |
9 import org.chromium.base.metrics.RecordHistogram; | 9 import org.chromium.base.metrics.RecordHistogram; |
10 | 10 |
11 /** | 11 /** |
12 * Disables histogram recording for the duration of the tests. | 12 * Disables histogram recording for the duration of the tests. |
13 */ | 13 */ |
14 public class DisableHistogramsRule extends ExternalResource { | 14 public class DisableHistogramsRule extends ExternalResource { |
15 | 15 |
16 @Override | 16 @Override |
17 protected void before() throws Throwable { | 17 protected void before() throws Throwable { |
18 RecordHistogram.setDisabledForTests(true); | 18 RecordHistogram.setDisabledForTests(true); |
19 } | 19 } |
20 | 20 |
21 @Override | 21 @Override |
22 protected void after() { | 22 protected void after() { |
23 RecordHistogram.setDisabledForTests(false); | 23 RecordHistogram.setDisabledForTests(false); |
24 } | 24 } |
25 } | 25 } |
OLD | NEW |