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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java

Issue 2689993002: Refactor the INSTALL_SHORTCUT broadcast code into ChromeShortcutManager (Closed)
Patch Set: Change according to review comments. Created 3 years, 10 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 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.banners; 5 package org.chromium.chrome.browser.banners;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.Instrumentation.ActivityMonitor; 8 import android.app.Instrumentation.ActivityMonitor;
9 import android.app.Instrumentation.ActivityResult; 9 import android.app.Instrumentation.ActivityResult;
10 import android.content.Context;
11 import android.content.Intent; 10 import android.content.Intent;
12 import android.content.IntentFilter; 11 import android.content.IntentFilter;
13 import android.content.pm.PackageInfo; 12 import android.content.pm.PackageInfo;
14 import android.content.pm.PackageManager; 13 import android.content.pm.PackageManager;
15 import android.graphics.Bitmap; 14 import android.graphics.Bitmap;
16 import android.support.test.filters.MediumTest; 15 import android.support.test.filters.MediumTest;
17 import android.support.test.filters.SmallTest; 16 import android.support.test.filters.SmallTest;
18 import android.test.mock.MockPackageManager; 17 import android.test.mock.MockPackageManager;
19 import android.text.TextUtils; 18 import android.text.TextUtils;
20 import android.view.View; 19 import android.view.View;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 startMainActivityOnBlankPage(); 174 startMainActivityOnBlankPage();
176 } 175 }
177 176
178 @Override 177 @Override
179 protected void setUp() throws Exception { 178 protected void setUp() throws Exception {
180 mPackageManager = new TestPackageManager(); 179 mPackageManager = new TestPackageManager();
181 AppBannerManager.setIsSupported(true); 180 AppBannerManager.setIsSupported(true);
182 AppBannerInfoBarDelegateAndroid.setPackageManagerForTesting(mPackageMana ger); 181 AppBannerInfoBarDelegateAndroid.setPackageManagerForTesting(mPackageMana ger);
183 ShortcutHelper.setDelegateForTests(new ShortcutHelper.Delegate() { 182 ShortcutHelper.setDelegateForTests(new ShortcutHelper.Delegate() {
184 @Override 183 @Override
185 public void sendBroadcast(Context context, Intent intent) { 184 public void addShortcutToHomescreen(String title, Bitmap icon, Inten t shortcutIntent) {
186 // Ignore to prevent adding homescreen shortcuts. 185 // Ignore to prevent adding homescreen shortcuts.
187 } 186 }
188 }); 187 });
189 188
190 super.setUp(); 189 super.setUp();
191 190
192 // Must be set after native has loaded. 191 // Must be set after native has loaded.
193 mDetailsDelegate = new MockAppDetailsDelegate(); 192 mDetailsDelegate = new MockAppDetailsDelegate();
194 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 193 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
195 @Override 194 @Override
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 }); 626 });
628 627
629 // Test that bitmap sizes match expectations. 628 // Test that bitmap sizes match expectations.
630 int idealSize = getActivity().getResources().getDimensionPixelSize( 629 int idealSize = getActivity().getResources().getDimensionPixelSize(
631 R.dimen.webapp_splash_image_size_ideal); 630 R.dimen.webapp_splash_image_size_ideal);
632 Bitmap splashImage = ShortcutHelper.decodeBitmapFromString(dataStorageFa ctory.mSplashImage); 631 Bitmap splashImage = ShortcutHelper.decodeBitmapFromString(dataStorageFa ctory.mSplashImage);
633 assertEquals(idealSize, splashImage.getWidth()); 632 assertEquals(idealSize, splashImage.getWidth());
634 assertEquals(idealSize, splashImage.getHeight()); 633 assertEquals(idealSize, splashImage.getHeight());
635 } 634 }
636 } 635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698