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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/IntentWithGesturesHandlerTest.java

Issue 2766373004: Convert the rest of chrome_public_test_apk InstrumentationTestCases to JUnit4 (Closed)
Patch Set: nits and rebase Created 3 years, 8 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.externalnav; 5 package org.chromium.chrome.browser.externalnav;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.net.Uri; 8 import android.net.Uri;
9 import android.support.test.filters.SmallTest; 9 import android.support.test.filters.SmallTest;
10 import android.test.InstrumentationTestCase; 10
11 import org.junit.After;
12 import org.junit.Assert;
13 import org.junit.Test;
14 import org.junit.runner.RunWith;
15
16 import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
11 17
12 /** 18 /**
13 * Instrumentation tests for {@link IntentWithGesturesHandler}. 19 * Instrumentation tests for {@link IntentWithGesturesHandler}.
14 */ 20 */
15 public class IntentWithGesturesHandlerTest extends InstrumentationTestCase { 21 @RunWith(ChromeJUnit4ClassRunner.class)
16 22 public class IntentWithGesturesHandlerTest {
17 @Override 23 @After
18 public void tearDown() throws Exception { 24 public void tearDown() throws Exception {
19 IntentWithGesturesHandler.getInstance().clear(); 25 IntentWithGesturesHandler.getInstance().clear();
20 super.tearDown();
21 } 26 }
22 27
28 @Test
23 @SmallTest 29 @SmallTest
24 public void testCanUseGestureTokenOnlyOnce() { 30 public void testCanUseGestureTokenOnlyOnce() {
25 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" )); 31 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" ));
26 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent); 32 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent);
27 assertTrue(intent.hasExtra(IntentWithGesturesHandler.EXTRA_USER_GESTURE_ TOKEN)); 33 Assert.assertTrue(intent.hasExtra(IntentWithGesturesHandler.EXTRA_USER_G ESTURE_TOKEN));
28 assertTrue(IntentWithGesturesHandler.getInstance().getUserGestureAndClea r(intent)); 34 Assert.assertTrue(IntentWithGesturesHandler.getInstance().getUserGesture AndClear(intent));
29 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent)); 35 Assert.assertFalse(IntentWithGesturesHandler.getInstance().getUserGestur eAndClear(intent));
30 } 36 }
31 37
38 @Test
32 @SmallTest 39 @SmallTest
33 public void testModifiedGestureToken() { 40 public void testModifiedGestureToken() {
34 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" )); 41 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" ));
35 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent); 42 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent);
36 intent.setData(Uri.parse("content://xyz")); 43 intent.setData(Uri.parse("content://xyz"));
37 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent)); 44 Assert.assertFalse(IntentWithGesturesHandler.getInstance().getUserGestur eAndClear(intent));
38 } 45 }
39 46
47 @Test
40 @SmallTest 48 @SmallTest
41 public void testPreviousGestureToken() { 49 public void testPreviousGestureToken() {
42 Intent intent1 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc ")); 50 Intent intent1 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc "));
43 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent1); 51 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent1);
44 Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://xyz ")); 52 Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://xyz "));
45 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent2); 53 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent2);
46 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent1)); 54 Assert.assertFalse(IntentWithGesturesHandler.getInstance().getUserGestur eAndClear(intent1));
47 } 55 }
48 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698