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

Unified Diff: ui/android/junit/src/org/chromium/ui/base/ClipboardTest.java

Issue 2766623003: Make Android Clipboard Keep Track of Last Modified Time (Closed)
Patch Set: ted's comments Created 3 years, 9 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: ui/android/junit/src/org/chromium/ui/base/ClipboardTest.java
diff --git a/ui/android/junit/src/org/chromium/ui/base/ClipboardTest.java b/ui/android/junit/src/org/chromium/ui/base/ClipboardTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..e4476ba473fd47b9ddc3efb4cf63012da3f30f3c
--- /dev/null
+++ b/ui/android/junit/src/org/chromium/ui/base/ClipboardTest.java
@@ -0,0 +1,32 @@
+// Copyright 2017 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.ui.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.annotation.Config;
+
+import org.chromium.base.test.util.AdvancedMockContext;
+import org.chromium.testing.local.LocalRobolectricTestRunner;
+
+/**
+ * Tests logic in the Clipboard class.
+ */
+@RunWith(LocalRobolectricTestRunner.class)
+@Config(manifest = Config.NONE)
+public class ClipboardTest {
+ @Test
+ public void testGetClipboardContentChangeTimeInMillis() {
+ // Upon launch, the clipboard should be at start of epoch, i.e., ancient.
+ Clipboard clipboard = new Clipboard(new AdvancedMockContext());
+ assertEquals(0, clipboard.getClipboardContentChangeTimeInMillis());
+ // After updating the clipboard, it should have a new time.
+ clipboard.onPrimaryClipChanged();
+ assertTrue(clipboard.getClipboardContentChangeTimeInMillis() > 0);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698