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

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: Use only a Set instead of a Set and a List 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
+ * {@link java.util.concurrent.atomic.AtomicInteger}.
+ */
+public class Counter {
+ private int mV;
+
+ 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