Chromium Code Reviews| 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()); |
|
Ted C
2017/03/23 20:59:31
The AndvancedMockContext is more designed for inst
|
| + assertEquals(0, clipboard.getClipboardContentChangeTimeInMillis()); |
| + // After updating the clipboard, it should have a new time. |
| + clipboard.onPrimaryClipChanged(); |
| + assertTrue(clipboard.getClipboardContentChangeTimeInMillis() > 0); |
| + } |
|
Ted C
2017/03/23 20:59:31
Maybe we could add a test where we mock the Clipbo
Mark P
2017/03/23 23:40:32
Why would we want to test that the change time doe
|
| +} |