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

Side by Side Diff: chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java

Issue 2710343003: Update Robolectric to 3.2.2 (Closed)
Patch Set: Small fix to StripLayoutHelperTest Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.webapk.shell_apk; 5 package org.chromium.webapk.shell_apk;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.content.pm.ActivityInfo; 8 import android.content.pm.ActivityInfo;
9 import android.content.pm.ResolveInfo; 9 import android.content.pm.ResolveInfo;
10 import android.os.Bundle; 10 import android.os.Bundle;
(...skipping 10 matching lines...) Expand all
21 import org.robolectric.shadows.ShadowApplication; 21 import org.robolectric.shadows.ShadowApplication;
22 22
23 import org.chromium.testing.local.LocalRobolectricTestRunner; 23 import org.chromium.testing.local.LocalRobolectricTestRunner;
24 import org.chromium.webapk.lib.common.WebApkMetaDataKeys; 24 import org.chromium.webapk.lib.common.WebApkMetaDataKeys;
25 import org.chromium.webapk.test.WebApkTestHelper; 25 import org.chromium.webapk.test.WebApkTestHelper;
26 26
27 /** 27 /**
28 * Tests MainActivity. 28 * Tests MainActivity.
29 */ 29 */
30 @RunWith(LocalRobolectricTestRunner.class) 30 @RunWith(LocalRobolectricTestRunner.class)
31 @Config(manifest = Config.NONE) 31 @Config(manifest = Config.NONE, packageName = WebApkTestHelper.WEBAPK_PACKAGE_NA ME)
32 public class MainActivityTest { 32 public class MainActivityTest {
33
34 private static final String HOST_BROWSER_PACKAGE_NAME = "truly.random"; 33 private static final String HOST_BROWSER_PACKAGE_NAME = "truly.random";
35 34
36 private ShadowApplication mShadowApplication; 35 private ShadowApplication mShadowApplication;
37 private RobolectricPackageManager mPackageManager; 36 private RobolectricPackageManager mPackageManager;
38 37
39 @Before 38 @Before
40 public void setUp() { 39 public void setUp() {
41 mShadowApplication = Shadows.shadowOf(RuntimeEnvironment.application); 40 mShadowApplication = Shadows.shadowOf(RuntimeEnvironment.application);
42 mShadowApplication.setPackageName(WebApkTestHelper.WEBAPK_PACKAGE_NAME);
43 mPackageManager = 41 mPackageManager =
44 (RobolectricPackageManager) RuntimeEnvironment.application.getPa ckageManager(); 42 (RobolectricPackageManager) RuntimeEnvironment.application.getPa ckageManager();
45 } 43 }
46 44
47 /** 45 /**
48 * Tests that when the user launches the WebAPK and the user does not have a ny browser installed 46 * Tests that when the user launches the WebAPK and the user does not have a ny browser installed
49 * that the WebAPK launches Google Play to install the host browser. 47 * that the WebAPK launches Google Play to install the host browser.
50 */ 48 */
51 @Test 49 @Test
52 public void testBrowserNotInstalled() { 50 public void testBrowserNotInstalled() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 91 }
94 92
95 private static ResolveInfo newResolveInfo(String packageName) { 93 private static ResolveInfo newResolveInfo(String packageName) {
96 ActivityInfo activityInfo = new ActivityInfo(); 94 ActivityInfo activityInfo = new ActivityInfo();
97 activityInfo.packageName = packageName; 95 activityInfo.packageName = packageName;
98 ResolveInfo resolveInfo = new ResolveInfo(); 96 ResolveInfo resolveInfo = new ResolveInfo();
99 resolveInfo.activityInfo = activityInfo; 97 resolveInfo.activityInfo = activityInfo;
100 return resolveInfo; 98 return resolveInfo;
101 } 99 }
102 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698