Chromium Code Reviews| Index: remoting/android/javatests/src/org/chromium/chromoting/Counter.java |
| diff --git a/remoting/android/javatests/src/org/chromium/chromoting/Counter.java b/remoting/android/javatests/src/org/chromium/chromoting/Counter.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dbdd2b259ca7870d9c6aeef43f91095646a9af4a |
| --- /dev/null |
| +++ b/remoting/android/javatests/src/org/chromium/chromoting/Counter.java |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chromoting; |
| + |
| +/** |
| + * A pointer of an integer, users can {@link set} / {@link get} / {@link increment} / |
| + * {@link decrement} to its value. This class is usually useful in test cases. This class is not |
| + * thread-safe, for a thread-safe implementation, use |
|
Lambros
2016/05/27 22:26:07
Grammar nit: Replace first , with ;
Hzj_jie
2016/05/28 00:32:07
Done.
|
| + * {@link java.util.concurrent.atomic.AtomicInteger}. |
| + */ |
| +public class Counter { |
|
Lambros
2016/05/27 22:26:07
Put this in a 'util' sub-package, and maybe call i
Hzj_jie
2016/05/28 00:32:07
Done.
|
| + private int mV; |
|
Lambros
2016/05/27 22:26:07
'mValue' preferred (and 'value' for parameters).
I
Hzj_jie
2016/05/28 00:32:07
Done.
|
| + |
| + public Counter() { |
| + set(0); |
| + } |
| + |
| + public void increment() { |
| + mV++; |
| + } |
| + |
| + public void decrement() { |
| + mV--; |
| + } |
| + |
| + public void set(int v) { |
| + mV = v; |
| + } |
| + |
| + public int get() { |
| + return mV; |
| + } |
| +} |