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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 @Override | 147 @Override |
148 public void run() { | 148 public void run() { |
149 AppBannerManager.setAppDetailsDelegate(mDetailsDelegate); | 149 AppBannerManager.setAppDetailsDelegate(mDetailsDelegate); |
150 } | 150 } |
151 }); | 151 }); |
152 | 152 |
153 AppBannerManager.disableSecureSchemeCheckForTesting(); | 153 AppBannerManager.disableSecureSchemeCheckForTesting(); |
154 | 154 |
155 // Navigations in this test are all of type ui::PAGE_TRANSITION_LINK, i.
e. indirect. | 155 // Navigations in this test are all of type ui::PAGE_TRANSITION_LINK, i.
e. indirect. |
156 // Force indirect navigations to be worth the same as direct for testing
. | 156 // Force indirect navigations to be worth the same as direct for testing
. |
157 AppBannerManager.setEngagementWeights(1, 1); | 157 AppBannerManager.forceEngagementWeightsForTesting(1, 1); |
158 } | 158 } |
159 | 159 |
160 private boolean waitUntilNoInfoBarsExist() throws Exception { | 160 private boolean waitUntilNoInfoBarsExist() throws Exception { |
161 return CriteriaHelper.pollForUIThreadCriteria(new Criteria() { | 161 return CriteriaHelper.pollForUIThreadCriteria(new Criteria() { |
162 @Override | 162 @Override |
163 public boolean isSatisfied() { | 163 public boolean isSatisfied() { |
164 InfoBarContainer container = getActivity().getActivityTab().getI
nfoBarContainer(); | 164 InfoBarContainer container = getActivity().getActivityTab().getI
nfoBarContainer(); |
165 return container.getInfoBars().size() == 0; | 165 return container.getInfoBars().size() == 0; |
166 } | 166 } |
167 }); | 167 }); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 @Override | 440 @Override |
441 public boolean isSatisfied() { | 441 public boolean isSatisfied() { |
442 AppBannerManager manager = | 442 AppBannerManager manager = |
443 getActivity().getActivityTab().getAppBannerManagerForTes
ting(); | 443 getActivity().getActivityTab().getAppBannerManagerForTes
ting(); |
444 return !manager.isFetcherActiveForTesting(); | 444 return !manager.isFetcherActiveForTesting(); |
445 } | 445 } |
446 })); | 446 })); |
447 assertTrue(waitUntilAppBannerInfoBarAppears(WEB_APP_TITLE)); | 447 assertTrue(waitUntilAppBannerInfoBarAppears(WEB_APP_TITLE)); |
448 } | 448 } |
449 } | 449 } |
OLD | NEW |