| Index: chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java
|
| diff --git a/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java b/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java
|
| index 4386426595045072aa7ad0ae471ffdd23bbd1537..24c142d5f018403969cb9e0ec9b81a14159d3683 100644
|
| --- a/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java
|
| +++ b/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java
|
| @@ -23,11 +23,14 @@ import org.chromium.content.browser.ContentViewCore;
|
| import org.chromium.content.browser.test.util.Criteria;
|
| import org.chromium.content.browser.test.util.CriteriaHelper;
|
| import org.chromium.content.browser.test.util.JavaScriptUtils;
|
| +import org.chromium.content_public.browser.LoadUrlParams;
|
| import org.chromium.sync.AndroidSyncSettings;
|
| +import org.chromium.sync.internal_api.pub.base.ModelType;
|
| import org.chromium.sync.signin.AccountManagerHelper;
|
| import org.chromium.sync.signin.ChromeSigninController;
|
| import org.chromium.sync.test.util.MockAccountManager;
|
| import org.chromium.sync.test.util.MockSyncContentResolverDelegate;
|
| +import org.chromium.ui.base.PageTransition;
|
|
|
| import java.util.concurrent.TimeoutException;
|
|
|
| @@ -43,6 +46,7 @@ public class SyncTest extends ChromeShellTestBase {
|
| private SyncTestUtil.SyncTestContext mContext;
|
| private MockAccountManager mAccountManager;
|
| private SyncController mSyncController;
|
| + private FakeServerHelper mFakeServerHelper;
|
|
|
| @Override
|
| protected void setUp() throws Exception {
|
| @@ -66,6 +70,7 @@ public class SyncTest extends ChromeShellTestBase {
|
| @Override
|
| public void run() {
|
| mSyncController = SyncController.get(mContext);
|
| + mFakeServerHelper = FakeServerHelper.get();
|
| }
|
| });
|
| FakeServerHelper.useFakeServer(getInstrumentation().getTargetContext());
|
| @@ -181,6 +186,39 @@ public class SyncTest extends ChromeShellTestBase {
|
| SyncTestUtil.verifySignedInWithAccount(mContext, account);
|
| }
|
|
|
| + @LargeTest
|
| + @Feature({"Sync"})
|
| + public void testUploadTypedUrl() throws Exception {
|
| + setupTestAccountAndSignInToSync(FOREIGN_SESSION_TEST_MACHINE_ID);
|
| +
|
| + // TestHttpServerClient is preferred here but it can't be used. The test server
|
| + // serves pages on localhost and Chrome doesn't sync localhost URLs as typed URLs.
|
| + // This type of URL requires no external data connection or resources.
|
| + final String urlToLoad = "data:text,testTypedUrl";
|
| + assertTrue("A typed URL entity for " + urlToLoad + " already exists on the fake server.",
|
| + mFakeServerHelper.verifyEntityCountByTypeAndName(0, ModelType.TYPED_URL,
|
| + urlToLoad));
|
| +
|
| + ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + LoadUrlParams params = new LoadUrlParams(urlToLoad, PageTransition.TYPED);
|
| + getActivity().getActiveTab().loadUrl(params);
|
| + }
|
| + });
|
| +
|
| + boolean synced = CriteriaHelper.pollForCriteria(new Criteria() {
|
| + @Override
|
| + public boolean isSatisfied() {
|
| + return mFakeServerHelper.verifyEntityCountByTypeAndName(1, ModelType.TYPED_URL,
|
| + urlToLoad);
|
| + }
|
| + }, SyncTestUtil.UI_TIMEOUT_MS, SyncTestUtil.CHECK_INTERVAL_MS);
|
| +
|
| + assertTrue("The typed URL entity for " + urlToLoad + " was not found on the fake server.",
|
| + synced);
|
| + }
|
| +
|
| private void setupTestAccountAndSignInToSync(
|
| final String syncClientIdentifier)
|
| throws InterruptedException {
|
|
|