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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java

Issue 2689993002: Refactor the INSTALL_SHORTCUT broadcast code into ChromeShortcutManager (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
index 8ee878c1c419f5465a54a4cb52175a021ce33d92..fe21ea8984f2e866d6b9e16ec875290f0b511a8c 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
@@ -76,11 +76,11 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
private static final String EVENT_WEBAPP_TITLE = "appinstalled event test page";
private static class TestShortcutHelperDelegate extends ShortcutHelper.Delegate {
- public Intent mBroadcastedIntent;
+ public Intent mRequestedPinShortcutIntent;
@Override
- public void sendBroadcast(Context context, Intent intent) {
- mBroadcastedIntent = intent;
+ public void requestPinShortcut(Context context, Intent intent) {
+ mRequestedPinShortcutIntent = intent;
}
@Override
@@ -88,8 +88,8 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
return WEBAPP_ACTION_NAME;
}
- public void clearBroadcastedIntent() {
- mBroadcastedIntent = null;
+ public void clearRequestedPinShortcutIntent() {
+ mRequestedPinShortcutIntent = null;
}
}
@@ -177,7 +177,7 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
// Add a webapp shortcut and make sure the intent's parameters make sense.
loadUrl(WEBAPP_HTML, WEBAPP_TITLE);
addShortcutToTab(mTab, "");
- Intent firedIntent = mShortcutHelperDelegate.mBroadcastedIntent;
+ Intent firedIntent = mShortcutHelperDelegate.mRequestedPinShortcutIntent;
assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
Intent launchIntent = firedIntent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
@@ -186,10 +186,10 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
assertEquals(mActivity.getPackageName(), launchIntent.getPackage());
// Add a second shortcut and make sure it matches the second webapp's parameters.
- mShortcutHelperDelegate.clearBroadcastedIntent();
+ mShortcutHelperDelegate.clearRequestedPinShortcutIntent();
loadUrl(SECOND_WEBAPP_HTML, SECOND_WEBAPP_TITLE);
addShortcutToTab(mTab, "");
- Intent newFiredIntent = mShortcutHelperDelegate.mBroadcastedIntent;
+ Intent newFiredIntent = mShortcutHelperDelegate.mRequestedPinShortcutIntent;
assertEquals(SECOND_WEBAPP_TITLE,
newFiredIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
@@ -206,7 +206,7 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
addShortcutToTab(mTab, "");
// Make sure the intent's parameters make sense.
- Intent firedIntent = mShortcutHelperDelegate.mBroadcastedIntent;
+ Intent firedIntent = mShortcutHelperDelegate.mRequestedPinShortcutIntent;
assertEquals(NORMAL_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
Intent launchIntent = firedIntent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
@@ -221,7 +221,7 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
// Add a webapp shortcut using the page's title.
loadUrl(WEBAPP_HTML, WEBAPP_TITLE);
addShortcutToTab(mTab, "");
- Intent firedIntent = mShortcutHelperDelegate.mBroadcastedIntent;
+ Intent firedIntent = mShortcutHelperDelegate.mRequestedPinShortcutIntent;
assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
}
@@ -231,7 +231,7 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
// Add a webapp shortcut with a custom title.
loadUrl(WEBAPP_HTML, WEBAPP_TITLE);
addShortcutToTab(mTab, EDITED_WEBAPP_TITLE);
- Intent firedIntent = mShortcutHelperDelegate.mBroadcastedIntent;
+ Intent firedIntent = mShortcutHelperDelegate.mRequestedPinShortcutIntent;
assertEquals(EDITED_WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
}
@@ -240,7 +240,7 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
public void testAddWebappShortcutsWithApplicationName() throws Exception {
loadUrl(META_APP_NAME_HTML, META_APP_NAME_PAGE_TITLE);
addShortcutToTab(mTab, "");
- Intent firedIntent = mShortcutHelperDelegate.mBroadcastedIntent;
+ Intent firedIntent = mShortcutHelperDelegate.mRequestedPinShortcutIntent;
assertEquals(META_APP_NAME_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
}
@@ -314,7 +314,7 @@ public class AddToHomescreenManagerTest extends ChromeActivityTestCaseBase<Chrom
CriteriaHelper.pollUiThread(new Criteria() {
@Override
public boolean isSatisfied() {
- return mShortcutHelperDelegate.mBroadcastedIntent != null;
+ return mShortcutHelperDelegate.mRequestedPinShortcutIntent != null;
}
});

Powered by Google App Engine
This is Rietveld 408576698