Commit 8768885b authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

weblayer: update version checks for recent profile changes

All the code was merged to the 87 branch, so the version
checks can now be updated.

BUG=1142989
TEST=covered by skew tests

Change-Id: I861b832f7e80cd09b5b06914835cdd435612a2c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527893
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825918}
parent fe292575
......@@ -387,7 +387,7 @@ public class BrowserFragmentLifecycleTest {
@Test
@SmallTest
@MinWebLayerVersion(88)
@MinWebLayerVersion(87)
public void twoFragmentsDifferentIncognitoProfiles() throws Throwable {
// This test creates two browsers with different profile names and persistence ids.
final String persistenceId1 = "x";
......@@ -467,7 +467,7 @@ public class BrowserFragmentLifecycleTest {
@Test
@SmallTest
@MinWebLayerVersion(88)
@MinWebLayerVersion(87)
public void twoFragmentsSameIncognitoProfile() throws Throwable {
// This test creates two browsers with the same profile, but different persistence ids.
final String persistenceId1 = "x";
......
......@@ -91,7 +91,7 @@ public class ProfileTest {
@Test
@SmallTest
@MinWebLayerVersion(88)
@MinWebLayerVersion(87)
public void testDestroyAndDeleteDataFromDiskSoonWhenInUse() throws Exception {
WebLayer weblayer = mActivityTestRule.getWebLayer();
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank");
......@@ -263,7 +263,7 @@ public class ProfileTest {
@Test
@SmallTest
@MinWebLayerVersion(88)
@MinWebLayerVersion(87)
public void testMultipleIncognitoProfiles() throws Exception {
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank");
......
......@@ -57,7 +57,7 @@ public final class ProfileImpl
private IUserIdentityCallbackClient mUserIdentityCallbackClient;
private List<Intent> mDownloadNotificationIntents = new ArrayList<>();
// This was added in 88, and is null in any version before that.
// This was added in 87, and is null in any version before that.
private IProfileClient mClient;
// If non-null, indicates when no browsers reference this Profile the Profile is destroyed. The
......
......@@ -11,7 +11,7 @@ public interface BrowserFragmentArgs {
/**
* A boolean value indicating whether the profile is incognito.
*
* @since 88
* @since 87
*/
String IS_INCOGNITO = "is_incognito";
}
......@@ -47,8 +47,6 @@ interface IProfile {
// Added in Version 87.
void setUserIdentityCallbackClient(IUserIdentityCallbackClient client) = 13;
IPrerenderController getPrerenderController() = 15;
// Added in Version 88.
boolean isIncognito() = 16;
void setClient(in IProfileClient client) = 17;
void destroyAndDeleteDataFromDiskSoon(in IObjectWrapper completeCallback) = 18;
......
......@@ -104,9 +104,12 @@ interface IWebLayer {
IObjectWrapper getApplicationContext() = 20;
IMediaRouteDialogFragment createMediaRouteDialogFragmentImpl(
in IRemoteFragmentClient remoteFragmentClient) = 21;
IProfile getIncognitoProfile(in String profileName) = 24;
// Added in Version 88.
void onRemoteMediaServiceStarted(in IObjectWrapper sessionService, in Intent intent) = 22;
void onRemoteMediaServiceDestroyed(int id) = 23;
IProfile getIncognitoProfile(in String profileName) = 24;
// WARNING: when choosing next value make sure you look back for the max, as
// merges may mean the last function does not have the max value.
}
......@@ -81,8 +81,8 @@ public final class BrowserFragment extends RemoteFragment {
// want to trigger loading WebLayer.
if (args.getBoolean(BrowserFragmentArgs.IS_INCOGNITO, false)) {
String name = args.getString(BrowserFragmentArgs.PROFILE_NAME);
if (!"".equals(name) && WebLayer.getSupportedMajorVersionInternal() < 88) {
throw new UnsupportedOperationException("Named incognito profile requires 88");
if (!"".equals(name) && WebLayer.getSupportedMajorVersionInternal() < 87) {
throw new UnsupportedOperationException("Named incognito profile requires 87");
}
}
try {
......
......@@ -47,7 +47,7 @@ public class Profile {
throw new APICallException(e);
}
boolean isIncognito;
if (WebLayer.getSupportedMajorVersionInternal() < 88) {
if (WebLayer.getSupportedMajorVersionInternal() < 87) {
isIncognito = "".equals(name);
} else {
try {
......@@ -114,7 +114,7 @@ public class Profile {
sProfiles.put(name, this);
}
if (WebLayer.getSupportedMajorVersionInternal() >= 88) {
if (WebLayer.getSupportedMajorVersionInternal() >= 87) {
try {
mImpl.setClient(new ProfileClientImpl());
} catch (RemoteException e) {
......@@ -124,11 +124,11 @@ public class Profile {
}
/**
* Returns the name of the profile. While added in 88, this can be used with any version.
* Returns the name of the profile. While added in 87, this can be used with any version.
*
* @return The name of the profile.
*
* @since 88
* @since 87
*/
@NonNull
public String getName() {
......@@ -136,12 +136,12 @@ public class Profile {
}
/**
* Returns true if the profile is incognito. While added in 88, this can be used with any
* Returns true if the profile is incognito. While added in 87, this can be used with any
* version.
*
* @return True if the profile is incognito.
*
* @since 88
* @since 87
*/
public boolean isIncognito() {
return mIsIncognito;
......@@ -213,11 +213,11 @@ public class Profile {
* @param completionCallback Callback this is notified when destruction is complete. This may
* never be called.
*
* @since 88
* @since 87
*/
public void destroyAndDeleteDataFromDiskSoon(@Nullable Runnable completionCallback) {
ThreadCheck.ensureOnUiThread();
if (WebLayer.getSupportedMajorVersionInternal() < 88) {
if (WebLayer.getSupportedMajorVersionInternal() < 87) {
throw new UnsupportedOperationException();
}
throwIfDestroyed();
......
......@@ -45,7 +45,7 @@ public class SiteSettingsActivity extends AppCompatActivity {
* @param profileName The name of the profile.
* @param isIncognito If the profile is incognito.
*
* @since 88
* @since 87
*/
public static Intent createIntentForCategoryList(
Context context, String profileName, boolean isIncognito) {
......
......@@ -430,12 +430,12 @@ public class WebLayer {
*
* @param profileName The name of the profile. Null is mapped to an empty string.
*
* @since 88
* @since 87
*/
@NonNull
public Profile getIncognitoProfile(@Nullable String profileName) {
ThreadCheck.ensureOnUiThread();
if (WebLayer.getSupportedMajorVersionInternal() < 88) {
if (WebLayer.getSupportedMajorVersionInternal() < 87) {
throw new UnsupportedOperationException();
}
IProfile iprofile;
......@@ -544,10 +544,10 @@ public class WebLayer {
* state.
*
* @throws UnsupportedOperationException If {@link params} is incognito and name is not empty
* and <= 88. In order for this function not to trigger loading of WebLayer the
* and <= 87. In order for this function not to trigger loading of WebLayer the
* exception is thrown later on.
*
* @since 88
* @since 87
*/
@NonNull
public static Fragment createBrowserFragmentWithIncognitoProfile(
......@@ -558,7 +558,7 @@ public class WebLayer {
private static Fragment createBrowserFragmentImpl(
@NonNull String profileName, @Nullable String persistenceId, boolean isIncognito) {
ThreadCheck.ensureOnUiThread();
// Support for named incognito profiles was added in 88. Checking is done in
// Support for named incognito profiles was added in 87. Checking is done in
// BrowserFragment, as this code should not trigger loading WebLayer.
Bundle args = new Bundle();
args.putString(BrowserFragmentArgs.PROFILE_NAME, profileName);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment