OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.webapps; | 5 package org.chromium.chrome.browser.webapps; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.support.test.filters.LargeTest; | 8 import android.support.test.filters.LargeTest; |
9 | 9 |
10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
11 import org.chromium.base.test.util.ScalableTimeout; | 11 import org.chromium.base.test.util.ScalableTimeout; |
12 import org.chromium.chrome.browser.ShortcutHelper; | 12 import org.chromium.chrome.browser.ShortcutHelper; |
13 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 13 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
14 import org.chromium.chrome.test.util.ChromeTabUtils; | 14 import org.chromium.chrome.test.util.ChromeTabUtils; |
15 import org.chromium.content.browser.test.util.Criteria; | 15 import org.chromium.content.browser.test.util.Criteria; |
16 import org.chromium.content.browser.test.util.CriteriaHelper; | 16 import org.chromium.content.browser.test.util.CriteriaHelper; |
17 import org.chromium.net.test.EmbeddedTestServer; | 17 import org.chromium.net.test.EmbeddedTestServer; |
| 18 import org.chromium.webapk.lib.common.WebApkConstants; |
18 | 19 |
19 /** Integration tests for WebAPK feature. */ | 20 /** Integration tests for WebAPK feature. */ |
20 public class WebApkIntegrationTest extends ChromeActivityTestCaseBase<WebApkActi
vity> { | 21 public class WebApkIntegrationTest extends ChromeActivityTestCaseBase<WebApkActi
vity> { |
21 private static final long STARTUP_TIMEOUT = ScalableTimeout.scaleTimeout(100
00); | 22 private static final long STARTUP_TIMEOUT = ScalableTimeout.scaleTimeout(100
00); |
22 | 23 |
23 private EmbeddedTestServer mTestServer; | 24 private EmbeddedTestServer mTestServer; |
24 | 25 |
25 public WebApkIntegrationTest() { | 26 public WebApkIntegrationTest() { |
26 super(WebApkActivity.class); | 27 super(WebApkActivity.class); |
27 } | 28 } |
28 | 29 |
29 public void startWebApkActivity(String webApkPackageName, final String start
Url) | 30 public void startWebApkActivity(String webApkPackageName, final String start
Url) |
30 throws InterruptedException { | 31 throws InterruptedException { |
31 Intent intent = new Intent(getInstrumentation().getTargetContext(), WebA
pkActivity.class); | 32 Intent intent = new Intent(getInstrumentation().getTargetContext(), WebA
pkActivity.class); |
32 intent.putExtra(ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME, webApkPackageN
ame); | 33 intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, webApkPackage
Name); |
33 intent.putExtra(ShortcutHelper.EXTRA_URL, startUrl); | 34 intent.putExtra(ShortcutHelper.EXTRA_URL, startUrl); |
34 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 35 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
35 setActivity(getInstrumentation().startActivitySync(intent)); | 36 setActivity(getInstrumentation().startActivitySync(intent)); |
36 getInstrumentation().waitForIdleSync(); | 37 getInstrumentation().waitForIdleSync(); |
37 | 38 |
38 CriteriaHelper.pollInstrumentationThread(new Criteria() { | 39 CriteriaHelper.pollInstrumentationThread(new Criteria() { |
39 @Override | 40 @Override |
40 public boolean isSatisfied() { | 41 public boolean isSatisfied() { |
41 return getActivity().getActivityTab() != null; | 42 return getActivity().getActivityTab() != null; |
42 } | 43 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 * eventually hides. | 79 * eventually hides. |
79 */ | 80 */ |
80 @LargeTest | 81 @LargeTest |
81 @Feature({"WebApk"}) | 82 @Feature({"WebApk"}) |
82 public void testLaunch() throws InterruptedException { | 83 public void testLaunch() throws InterruptedException { |
83 startWebApkActivity("org.chromium.webapk.test", | 84 startWebApkActivity("org.chromium.webapk.test", |
84 mTestServer.getURL("/chrome/test/data/android/test.html")); | 85 mTestServer.getURL("/chrome/test/data/android/test.html")); |
85 waitUntilSplashscreenHides(); | 86 waitUntilSplashscreenHides(); |
86 } | 87 } |
87 } | 88 } |
OLD | NEW |