Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: base/test/android/javatests/src/org/chromium/base/test/util/ScalableTimeout.java

Issue 600983002: [Checkstyle] Fix misc style issues in Java files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.base.test.util; 5 package org.chromium.base.test.util;
6 6
7 /** 7 /**
8 * Utility class for scaling various timeouts by a common factor. 8 * Utility class for scaling various timeouts by a common factor.
9 * For example, to run tests under Valgrind, you might want the following: 9 * For example, to run tests under Valgrind, you might want the following:
10 * adb shell "echo 20.0 > /data/local/tmp/chrome_timeout_scale" 10 * adb shell "echo 20.0 > /data/local/tmp/chrome_timeout_scale"
11 */ 11 */
12 public class ScalableTimeout { 12 public class ScalableTimeout {
13 private static Double sTimeoutScale = null; 13 private static Double sTimeoutScale = null;
14 private static final String PROPERTY_FILE = "/data/local/tmp/chrome_timeout_ scale"; 14 private static final String PROPERTY_FILE = "/data/local/tmp/chrome_timeout_ scale";
15 15
16 public static long scaleTimeout(long timeout) { 16 public static long scaleTimeout(long timeout) {
17 if (sTimeoutScale == null) { 17 if (sTimeoutScale == null) {
18 try { 18 try {
19 char[] data = TestFileUtil.readUtf8File(PROPERTY_FILE, 32); 19 char[] data = TestFileUtil.readUtf8File(PROPERTY_FILE, 32);
20 sTimeoutScale = Double.parseDouble(new String(data)); 20 sTimeoutScale = Double.parseDouble(new String(data));
21 } catch (Exception e) { 21 } catch (Exception e) {
22 // NumberFormatException, FileNotFoundException, IOException 22 // NumberFormatException, FileNotFoundException, IOException
23 sTimeoutScale = 1.0; 23 sTimeoutScale = 1.0;
24 } 24 }
25 } 25 }
26 return (long)(timeout * sTimeoutScale); 26 return (long) (timeout * sTimeoutScale);
27 } 27 }
28 } 28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698