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

Side by Side Diff: content/public/android/junit/src/org/chromium/content/browser/input/RangeTest.java

Issue 1278593004: Introduce ThreadedInputConnection behind a switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handles render crash and navigation Created 4 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.content.browser.input;
6
7 import static org.junit.Assert.assertEquals;
8 import static org.junit.Assert.assertFalse;
9 import static org.junit.Assert.assertTrue;
10
11 import org.chromium.base.test.util.Feature;
12 import org.chromium.testing.local.LocalRobolectricTestRunner;
13 import org.junit.Test;
14 import org.junit.runner.RunWith;
15 import org.robolectric.annotation.Config;
16
17 /**
18 * Unit tests for {@Range}.
19 */
20 @RunWith(LocalRobolectricTestRunner.class)
21 @Config(manifest = Config.NONE)
Ted C 2016/02/02 23:14:43 Can this just be a simple junit test instead of ne
Changwan Ryu 2016/02/11 16:21:08 Done.
22 public class RangeTest {
23
24 @Test
25 @Feature({"TextInput"})
26 public void test_clamp() {
27 // Overlap case #1
28 Range range = new Range(1, 4);
29 range.clamp(2, 5);
30 assertEquals(new Range(2, 4), range);
31 // Overlap case #2
32 range.set(1, 4);
33 range.clamp(0, 2);
34 assertEquals(new Range(1, 2), range);
35 // Clamp on both ends
36 range.set(1, 4);
37 range.clamp(2, 3);
38 assertEquals(new Range(2, 3), range);
39 // No-op
40 range.set(1, 4);
41 range.clamp(0, 5);
42 assertEquals(new Range(1, 4), range);
43 }
44
45 @Test
46 @Feature({"TextInput"})
47 public void test_equals() {
48 assertTrue(new Range(1, 3).equals(new Range(1, 3)));
49 assertFalse(new Range(1, 2).equals(new Range(1, 3)));
50 Range range = new Range(1, 4);
51 assertTrue(range.equals(range));
52 }
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698