| OLD | NEW |
| 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.document; | 5 package org.chromium.chrome.browser.document; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.net.Uri; | 9 import android.net.Uri; |
| 10 import android.os.Build; | 10 import android.os.Build; |
| 11 import android.view.ContextMenu; | 11 import android.view.ContextMenu; |
| 12 import android.view.View; | 12 import android.view.View; |
| 13 | 13 |
| 14 import org.chromium.base.ActivityState; | 14 import org.chromium.base.ActivityState; |
| 15 import org.chromium.base.ApplicationStatus; | 15 import org.chromium.base.ApplicationStatus; |
| 16 import org.chromium.base.ThreadUtils; | 16 import org.chromium.base.ThreadUtils; |
| 17 import org.chromium.base.test.util.MinAndroidSdkLevel; | 17 import org.chromium.base.test.util.MinAndroidSdkLevel; |
| 18 import org.chromium.base.test.util.Restriction; |
| 18 import org.chromium.chrome.R; | 19 import org.chromium.chrome.R; |
| 19 import org.chromium.chrome.browser.ChromeApplication; | 20 import org.chromium.chrome.browser.ChromeApplication; |
| 20 import org.chromium.chrome.browser.ChromeTabbedActivity; | 21 import org.chromium.chrome.browser.ChromeTabbedActivity; |
| 21 import org.chromium.chrome.browser.IntentHandler; | 22 import org.chromium.chrome.browser.IntentHandler; |
| 22 import org.chromium.chrome.browser.preferences.DocumentModeManager; | 23 import org.chromium.chrome.browser.preferences.DocumentModeManager; |
| 23 import org.chromium.chrome.browser.tab.EmptyTabObserver; | 24 import org.chromium.chrome.browser.tab.EmptyTabObserver; |
| 24 import org.chromium.chrome.browser.tab.Tab; | 25 import org.chromium.chrome.browser.tab.Tab; |
| 25 import org.chromium.chrome.browser.tabmodel.TabModel; | 26 import org.chromium.chrome.browser.tabmodel.TabModel; |
| 26 import org.chromium.chrome.browser.tabmodel.TabModelUtils; | 27 import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
| 27 import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams; | 28 import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams; |
| 28 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; | 29 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; |
| 29 import org.chromium.chrome.test.MultiActivityTestBase; | 30 import org.chromium.chrome.test.MultiActivityTestBase; |
| 30 import org.chromium.chrome.test.util.ActivityUtils; | 31 import org.chromium.chrome.test.util.ActivityUtils; |
| 31 import org.chromium.chrome.test.util.ApplicationTestUtils; | 32 import org.chromium.chrome.test.util.ApplicationTestUtils; |
| 33 import org.chromium.chrome.test.util.ChromeRestriction; |
| 32 import org.chromium.chrome.test.util.ChromeTabUtils; | 34 import org.chromium.chrome.test.util.ChromeTabUtils; |
| 33 import org.chromium.content.browser.test.util.Criteria; | 35 import org.chromium.content.browser.test.util.Criteria; |
| 34 import org.chromium.content.browser.test.util.CriteriaHelper; | 36 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 35 import org.chromium.content.browser.test.util.TouchCommon; | 37 import org.chromium.content.browser.test.util.TouchCommon; |
| 36 import org.chromium.content_public.browser.LoadUrlParams; | 38 import org.chromium.content_public.browser.LoadUrlParams; |
| 37 | 39 |
| 38 import java.util.concurrent.Callable; | 40 import java.util.concurrent.Callable; |
| 39 | 41 |
| 40 /** | 42 /** |
| 41 * Used for testing the interactions of the DocumentTabModel with Android's Acti
vityManager. This | 43 * Used for testing the interactions of the DocumentTabModel with Android's Acti
vityManager. This |
| 42 * test suite actually fires Intents to start different DocumentActivities. | 44 * test suite actually fires Intents to start different DocumentActivities. |
| 43 * | 45 * |
| 44 * Note that this is different instrumenting one DocumentActivity in particular,
which should be | 46 * Note that this is different instrumenting one DocumentActivity in particular,
which should be |
| 45 * tested using the DocumentActivityTestBase class. | 47 * tested using the DocumentActivityTestBase class. |
| 46 */ | 48 */ |
| 47 @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) | 49 @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) |
| 50 @Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE) |
| 48 public class DocumentModeTestBase extends MultiActivityTestBase { | 51 public class DocumentModeTestBase extends MultiActivityTestBase { |
| 49 protected static final String TAG = "document"; | 52 protected static final String TAG = "document"; |
| 50 | 53 |
| 51 private boolean mPreviouslyOptedOut; | 54 private boolean mPreviouslyOptedOut; |
| 52 | 55 |
| 53 private static class TestTabObserver extends EmptyTabObserver { | 56 private static class TestTabObserver extends EmptyTabObserver { |
| 54 private ContextMenu mContextMenu; | 57 private ContextMenu mContextMenu; |
| 55 | 58 |
| 56 @Override | 59 @Override |
| 57 public void onContextMenuShown(Tab tab, ContextMenu menu) { | 60 public void onContextMenuShown(Tab tab, ContextMenu menu) { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 intent.setClassName(mContext, ChromeTabbedActivity.class.getName
()); | 344 intent.setClassName(mContext, ChromeTabbedActivity.class.getName
()); |
| 342 intent.setData(Uri.parse(url)); | 345 intent.setData(Uri.parse(url)); |
| 343 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTI
VITY_NEW_DOCUMENT); | 346 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTI
VITY_NEW_DOCUMENT); |
| 344 mContext.startActivity(intent); | 347 mContext.startActivity(intent); |
| 345 } | 348 } |
| 346 }; | 349 }; |
| 347 return ActivityUtils.waitForActivity(getInstrumentation(), ChromeTabbedA
ctivity.class, | 350 return ActivityUtils.waitForActivity(getInstrumentation(), ChromeTabbedA
ctivity.class, |
| 348 runnable); | 351 runnable); |
| 349 } | 352 } |
| 350 } | 353 } |
| OLD | NEW |