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

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: fix findbugs warning 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() throws Exception {
19 IntentWithGesturesHandler.getInstance().clear();
20 super.tearDown();
21 }
22
23 @SmallTest
24 public void testCanUseGestureTokenOnlyOnce() {
25 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" ));
26 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent);
27 assertTrue(intent.hasExtra(IntentWithGesturesHandler.EXTRA_USER_GESTURE_ TOKEN));
28 assertTrue(IntentWithGesturesHandler.getInstance().getUserGestureAndClea r(intent));
29 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent));
30 }
31
32 @SmallTest
33 public void testModifiedGestureToken() {
34 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc" ));
35 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent);
36 intent.setData(Uri.parse("content://xyz"));
37 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent));
38 }
39
40 @SmallTest
41 public void testPreviousGestureToken() {
42 Intent intent1 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://abc "));
43 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent1);
44 Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://xyz "));
45 IntentWithGesturesHandler.getInstance().onNewIntentWithGesture(intent2);
46 assertFalse(IntentWithGesturesHandler.getInstance().getUserGestureAndCle ar(intent1));
47 }
48 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/util/IntentUtils.java ('k') | chrome/browser/android/tab_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698