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.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.Intent; | 10 import android.content.Intent; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 protected void tearDown() throws Exception { | 207 protected void tearDown() throws Exception { |
208 mTestServer.stopAndDestroyServer(); | 208 mTestServer.stopAndDestroyServer(); |
209 super.tearDown(); | 209 super.tearDown(); |
210 } | 210 } |
211 | 211 |
212 private void resetEngagementForUrl(final String url, final double engagement
) { | 212 private void resetEngagementForUrl(final String url, final double engagement
) { |
213 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 213 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
214 @Override | 214 @Override |
215 public void run() { | 215 public void run() { |
216 SiteEngagementService.getForProfile(Profile.getLastUsedProfile()
) | 216 SiteEngagementService.getForProfile(Profile.getLastUsedProfile()
) |
217 .resetScoreForUrl(url, engagement); | 217 .resetBaseScoreForUrl(url, engagement); |
218 } | 218 } |
219 }); | 219 }); |
220 } | 220 } |
221 | 221 |
222 private void waitUntilAppDetailsRetrieved(final int numExpected) { | 222 private void waitUntilAppDetailsRetrieved(final int numExpected) { |
223 CriteriaHelper.pollUiThread(new Criteria() { | 223 CriteriaHelper.pollUiThread(new Criteria() { |
224 @Override | 224 @Override |
225 public boolean isSatisfied() { | 225 public boolean isSatisfied() { |
226 AppBannerManager manager = getActivity().getActivityTab().getApp
BannerManager(); | 226 AppBannerManager manager = getActivity().getActivityTab().getApp
BannerManager(); |
227 return mDetailsDelegate.mNumRetrieved == numExpected | 227 return mDetailsDelegate.mNumRetrieved == numExpected |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 }); | 626 }); |
627 | 627 |
628 // Test that bitmap sizes match expectations. | 628 // Test that bitmap sizes match expectations. |
629 int idealSize = getActivity().getResources().getDimensionPixelSize( | 629 int idealSize = getActivity().getResources().getDimensionPixelSize( |
630 R.dimen.webapp_splash_image_size_ideal); | 630 R.dimen.webapp_splash_image_size_ideal); |
631 Bitmap splashImage = ShortcutHelper.decodeBitmapFromString(dataStorageFa
ctory.mSplashImage); | 631 Bitmap splashImage = ShortcutHelper.decodeBitmapFromString(dataStorageFa
ctory.mSplashImage); |
632 assertEquals(idealSize, splashImage.getWidth()); | 632 assertEquals(idealSize, splashImage.getWidth()); |
633 assertEquals(idealSize, splashImage.getHeight()); | 633 assertEquals(idealSize, splashImage.getHeight()); |
634 } | 634 } |
635 } | 635 } |
OLD | NEW |