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

Unified Diff: remoting/android/javatests/src/org/chromium/chromoting/Counter.java

Issue 1999583002: Add Event and EventTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698