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 { ...@@ -387,7 +387,7 @@ public class BrowserFragmentLifecycleTest {
@Test @Test
@SmallTest @SmallTest
@MinWebLayerVersion(88) @MinWebLayerVersion(87)
public void twoFragmentsDifferentIncognitoProfiles() throws Throwable { public void twoFragmentsDifferentIncognitoProfiles() throws Throwable {
// This test creates two browsers with different profile names and persistence ids. // This test creates two browsers with different profile names and persistence ids.
final String persistenceId1 = "x"; final String persistenceId1 = "x";
...@@ -467,7 +467,7 @@ public class BrowserFragmentLifecycleTest { ...@@ -467,7 +467,7 @@ public class BrowserFragmentLifecycleTest {
@Test @Test
@SmallTest @SmallTest
@MinWebLayerVersion(88) @MinWebLayerVersion(87)
public void twoFragmentsSameIncognitoProfile() throws Throwable { public void twoFragmentsSameIncognitoProfile() throws Throwable {
// This test creates two browsers with the same profile, but different persistence ids. // This test creates two browsers with the same profile, but different persistence ids.
final String persistenceId1 = "x"; final String persistenceId1 = "x";
......
...@@ -91,7 +91,7 @@ public class ProfileTest { ...@@ -91,7 +91,7 @@ public class ProfileTest {
@Test @Test
@SmallTest @SmallTest
@MinWebLayerVersion(88) @MinWebLayerVersion(87)
public void testDestroyAndDeleteDataFromDiskSoonWhenInUse() throws Exception { public void testDestroyAndDeleteDataFromDiskSoonWhenInUse() throws Exception {
WebLayer weblayer = mActivityTestRule.getWebLayer(); WebLayer weblayer = mActivityTestRule.getWebLayer();
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank"); InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank");
...@@ -263,7 +263,7 @@ public class ProfileTest { ...@@ -263,7 +263,7 @@ public class ProfileTest {
@Test @Test
@SmallTest @SmallTest
@MinWebLayerVersion(88) @MinWebLayerVersion(87)
public void testMultipleIncognitoProfiles() throws Exception { public void testMultipleIncognitoProfiles() throws Exception {
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank"); InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank");
......
...@@ -57,7 +57,7 @@ public final class ProfileImpl ...@@ -57,7 +57,7 @@ public final class ProfileImpl
private IUserIdentityCallbackClient mUserIdentityCallbackClient; private IUserIdentityCallbackClient mUserIdentityCallbackClient;
private List<Intent> mDownloadNotificationIntents = new ArrayList<>(); 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; private IProfileClient mClient;
// If non-null, indicates when no browsers reference this Profile the Profile is destroyed. The // If non-null, indicates when no browsers reference this Profile the Profile is destroyed. The
......
...@@ -11,7 +11,7 @@ public interface BrowserFragmentArgs { ...@@ -11,7 +11,7 @@ public interface BrowserFragmentArgs {
/** /**
* A boolean value indicating whether the profile is incognito. * A boolean value indicating whether the profile is incognito.
* *
* @since 88 * @since 87
*/ */
String IS_INCOGNITO = "is_incognito"; String IS_INCOGNITO = "is_incognito";
} }
...@@ -47,8 +47,6 @@ interface IProfile { ...@@ -47,8 +47,6 @@ interface IProfile {
// Added in Version 87. // Added in Version 87.
void setUserIdentityCallbackClient(IUserIdentityCallbackClient client) = 13; void setUserIdentityCallbackClient(IUserIdentityCallbackClient client) = 13;
IPrerenderController getPrerenderController() = 15; IPrerenderController getPrerenderController() = 15;
// Added in Version 88.
boolean isIncognito() = 16; boolean isIncognito() = 16;
void setClient(in IProfileClient client) = 17; void setClient(in IProfileClient client) = 17;
void destroyAndDeleteDataFromDiskSoon(in IObjectWrapper completeCallback) = 18; void destroyAndDeleteDataFromDiskSoon(in IObjectWrapper completeCallback) = 18;
......
...@@ -104,9 +104,12 @@ interface IWebLayer { ...@@ -104,9 +104,12 @@ interface IWebLayer {
IObjectWrapper getApplicationContext() = 20; IObjectWrapper getApplicationContext() = 20;
IMediaRouteDialogFragment createMediaRouteDialogFragmentImpl( IMediaRouteDialogFragment createMediaRouteDialogFragmentImpl(
in IRemoteFragmentClient remoteFragmentClient) = 21; in IRemoteFragmentClient remoteFragmentClient) = 21;
IProfile getIncognitoProfile(in String profileName) = 24;
// Added in Version 88. // Added in Version 88.
void onRemoteMediaServiceStarted(in IObjectWrapper sessionService, in Intent intent) = 22; void onRemoteMediaServiceStarted(in IObjectWrapper sessionService, in Intent intent) = 22;
void onRemoteMediaServiceDestroyed(int id) = 23; 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 { ...@@ -81,8 +81,8 @@ public final class BrowserFragment extends RemoteFragment {
// want to trigger loading WebLayer. // want to trigger loading WebLayer.
if (args.getBoolean(BrowserFragmentArgs.IS_INCOGNITO, false)) { if (args.getBoolean(BrowserFragmentArgs.IS_INCOGNITO, false)) {
String name = args.getString(BrowserFragmentArgs.PROFILE_NAME); String name = args.getString(BrowserFragmentArgs.PROFILE_NAME);
if (!"".equals(name) && WebLayer.getSupportedMajorVersionInternal() < 88) { if (!"".equals(name) && WebLayer.getSupportedMajorVersionInternal() < 87) {
throw new UnsupportedOperationException("Named incognito profile requires 88"); throw new UnsupportedOperationException("Named incognito profile requires 87");
} }
} }
try { try {
......
...@@ -47,7 +47,7 @@ public class Profile { ...@@ -47,7 +47,7 @@ public class Profile {
throw new APICallException(e); throw new APICallException(e);
} }
boolean isIncognito; boolean isIncognito;
if (WebLayer.getSupportedMajorVersionInternal() < 88) { if (WebLayer.getSupportedMajorVersionInternal() < 87) {
isIncognito = "".equals(name); isIncognito = "".equals(name);
} else { } else {
try { try {
...@@ -114,7 +114,7 @@ public class Profile { ...@@ -114,7 +114,7 @@ public class Profile {
sProfiles.put(name, this); sProfiles.put(name, this);
} }
if (WebLayer.getSupportedMajorVersionInternal() >= 88) { if (WebLayer.getSupportedMajorVersionInternal() >= 87) {
try { try {
mImpl.setClient(new ProfileClientImpl()); mImpl.setClient(new ProfileClientImpl());
} catch (RemoteException e) { } catch (RemoteException e) {
...@@ -124,11 +124,11 @@ public class Profile { ...@@ -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. * @return The name of the profile.
* *
* @since 88 * @since 87
*/ */
@NonNull @NonNull
public String getName() { public String getName() {
...@@ -136,12 +136,12 @@ public class Profile { ...@@ -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. * version.
* *
* @return True if the profile is incognito. * @return True if the profile is incognito.
* *
* @since 88 * @since 87
*/ */
public boolean isIncognito() { public boolean isIncognito() {
return mIsIncognito; return mIsIncognito;
...@@ -213,11 +213,11 @@ public class Profile { ...@@ -213,11 +213,11 @@ public class Profile {
* @param completionCallback Callback this is notified when destruction is complete. This may * @param completionCallback Callback this is notified when destruction is complete. This may
* never be called. * never be called.
* *
* @since 88 * @since 87
*/ */
public void destroyAndDeleteDataFromDiskSoon(@Nullable Runnable completionCallback) { public void destroyAndDeleteDataFromDiskSoon(@Nullable Runnable completionCallback) {
ThreadCheck.ensureOnUiThread(); ThreadCheck.ensureOnUiThread();
if (WebLayer.getSupportedMajorVersionInternal() < 88) { if (WebLayer.getSupportedMajorVersionInternal() < 87) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
throwIfDestroyed(); throwIfDestroyed();
......
...@@ -45,7 +45,7 @@ public class SiteSettingsActivity extends AppCompatActivity { ...@@ -45,7 +45,7 @@ public class SiteSettingsActivity extends AppCompatActivity {
* @param profileName The name of the profile. * @param profileName The name of the profile.
* @param isIncognito If the profile is incognito. * @param isIncognito If the profile is incognito.
* *
* @since 88 * @since 87
*/ */
public static Intent createIntentForCategoryList( public static Intent createIntentForCategoryList(
Context context, String profileName, boolean isIncognito) { Context context, String profileName, boolean isIncognito) {
......
...@@ -430,12 +430,12 @@ public class WebLayer { ...@@ -430,12 +430,12 @@ public class WebLayer {
* *
* @param profileName The name of the profile. Null is mapped to an empty string. * @param profileName The name of the profile. Null is mapped to an empty string.
* *
* @since 88 * @since 87
*/ */
@NonNull @NonNull
public Profile getIncognitoProfile(@Nullable String profileName) { public Profile getIncognitoProfile(@Nullable String profileName) {
ThreadCheck.ensureOnUiThread(); ThreadCheck.ensureOnUiThread();
if (WebLayer.getSupportedMajorVersionInternal() < 88) { if (WebLayer.getSupportedMajorVersionInternal() < 87) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
IProfile iprofile; IProfile iprofile;
...@@ -544,10 +544,10 @@ public class WebLayer { ...@@ -544,10 +544,10 @@ public class WebLayer {
* state. * state.
* *
* @throws UnsupportedOperationException If {@link params} is incognito and name is not empty * @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. * exception is thrown later on.
* *
* @since 88 * @since 87
*/ */
@NonNull @NonNull
public static Fragment createBrowserFragmentWithIncognitoProfile( public static Fragment createBrowserFragmentWithIncognitoProfile(
...@@ -558,7 +558,7 @@ public class WebLayer { ...@@ -558,7 +558,7 @@ public class WebLayer {
private static Fragment createBrowserFragmentImpl( private static Fragment createBrowserFragmentImpl(
@NonNull String profileName, @Nullable String persistenceId, boolean isIncognito) { @NonNull String profileName, @Nullable String persistenceId, boolean isIncognito) {
ThreadCheck.ensureOnUiThread(); 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. // BrowserFragment, as this code should not trigger loading WebLayer.
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(BrowserFragmentArgs.PROFILE_NAME, profileName); 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