Commit 000c3cfa authored by Tanya Gupta's avatar Tanya Gupta Committed by Commit Bot

[SendTabToSelf] Kept the Java and Native versions of SendTabToSelfEntry in sync.

Change-Id: I4135a98530993749d653c23e26015096e8de0556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1597963
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Reviewed-by: default avatarJeffrey Cohen <jeffreycohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657422}
parent 58a21273
......@@ -24,22 +24,26 @@ public class SendTabToSelfEntry {
public final long sharedTime;
/** The time that the tab was navigated to. */
public final long originalNavigationTime;
/** The cache guid of the target device. */
public final String targetDeviceSyncCacheGuid;
public SendTabToSelfEntry(String guid, String url, String title, long sharedTime,
long originalNavigationTime, String deviceName) {
long originalNavigationTime, String deviceName, String targetDeviceSyncCacheGuid) {
this.guid = guid;
this.url = url;
this.title = title;
this.sharedTime = sharedTime;
this.originalNavigationTime = originalNavigationTime;
this.deviceName = deviceName;
this.targetDeviceSyncCacheGuid = targetDeviceSyncCacheGuid;
}
/** Used by native code in order to create a new object of this type. */
@CalledByNative
private static SendTabToSelfEntry createSendTabToSelfEntry(String mGuid, String mUrl,
String mTitle, long mSharedTime, long mOriginalNavigationTime, String mDeviceName) {
return new SendTabToSelfEntry(
mGuid, mUrl, mTitle, mSharedTime, mOriginalNavigationTime, mDeviceName);
String mTitle, long mSharedTime, long mOriginalNavigationTime, String mDeviceName,
String targetDeviceSyncCacheGuid) {
return new SendTabToSelfEntry(mGuid, mUrl, mTitle, mSharedTime, mOriginalNavigationTime,
mDeviceName, targetDeviceSyncCacheGuid);
}
}
......@@ -92,8 +92,8 @@ public class SendTabToSelfAndroidBridgeTest {
@Test
@SmallTest
public void testGetEntryByGUID() {
SendTabToSelfEntry expected = new SendTabToSelfEntry(
GUID, URL, TITLE, SHARE_TIME_MS, NAVIGATION_TIME_MS, DEVICE_NAME);
SendTabToSelfEntry expected = new SendTabToSelfEntry(GUID, URL, TITLE, SHARE_TIME_MS,
NAVIGATION_TIME_MS, DEVICE_NAME, TARGET_DEVICE_SYNC_CACHE_GUID);
when(mNativeMock.getEntryByGUID(eq(mProfile), anyString())).thenReturn(expected);
// Note that the GUID passed in this function does not match the GUID of the returned entry.
// This is okay because the purpose of the test is to make sure that the JNI layer passes
......@@ -106,6 +106,7 @@ public class SendTabToSelfAndroidBridgeTest {
Assert.assertEquals(expected.sharedTime, actual.sharedTime);
Assert.assertEquals(expected.originalNavigationTime, actual.originalNavigationTime);
Assert.assertEquals(expected.deviceName, actual.deviceName);
Assert.assertEquals(expected.targetDeviceSyncCacheGuid, actual.targetDeviceSyncCacheGuid);
}
@Test
......
......@@ -46,7 +46,8 @@ ScopedJavaLocalRef<jobject> CreateJavaSendTabToSelfEntry(
ConvertUTF8ToJavaString(env, entry->GetTitle()),
entry->GetSharedTime().ToJavaTime(),
entry->GetOriginalNavigationTime().ToJavaTime(),
ConvertUTF8ToJavaString(env, entry->GetDeviceName()));
ConvertUTF8ToJavaString(env, entry->GetDeviceName()),
ConvertUTF8ToJavaString(env, entry->GetTargetDeviceSyncCacheGuid()));
}
void LogModelLoadedInTime(bool status) {
......
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