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

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

Issue 1243253004: Pass user gesture bit when chrome handles an intent fired by itself (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: using token to verify intent from chrome Created 5 years, 4 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 2015 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.chrome.browser.externalnav;
6
7 import android.content.Intent;
8 import android.net.Uri;
9 import android.test.InstrumentationTestCase;
10 import android.test.suitebuilder.annotation.SmallTest;
11
12 /**
13 * Instrumentation tests for {@link IntentWithGesturesHandler}.
14 */
15 public class IntentWithGesturesHandlerTest extends InstrumentationTestCase {
16
17 @Override
18 public void tearDown() {
19 IntentWithGesturesHandler.getInstance().clear();
20 }
21
22 @SmallTest
23 public void testCanUseGestureTokenOnlyOnce() {
24 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" ));
25 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent);
26 assertTrue(intent.hasExtra(IntentWithGesturesHandler.EXTRA_USER_GESTURE_ TOKEN));
27 assertTrue(IntentWithGesturesHandler.getInstance().getUserGestureAndClea r(intent));
28 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent));
29 }
30
31 @SmallTest
32 public void testModifiedGestureToken() {
33 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" ));
34 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent);
35 intent.setData(Uri.parse("content://xyz"));
36 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent));
37 }
38
39 @SmallTest
40 public void testPreviousGestureToken() {
41 Intent intent1 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc "));
42 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent1);
43 Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://xyz "));
44 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent2);
45 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent1));
46 }
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698