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

Unified Diff: chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java

Issue 1168533002: [Sync] Improve Android typed URL tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 6 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
« no previous file with comments | « no previous file | chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
index 591d4a504e24560cde1a738ddc9e7819e90203a9..ce71b77fc213957aa3be89d482740f9c8216963d 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
@@ -8,11 +8,9 @@ import android.accounts.Account;
import android.app.Activity;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
-import android.util.Pair;
import org.chromium.base.ActivityState;
import org.chromium.base.ApplicationStatus;
-import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.shell.ChromeShellActivity;
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
@@ -20,18 +18,10 @@ 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.protocol.EntitySpecifics;
-import org.chromium.sync.protocol.SyncEnums;
-import org.chromium.sync.protocol.TypedUrlSpecifics;
import org.chromium.sync.signin.AccountManagerHelper;
import org.chromium.sync.signin.ChromeSigninController;
-import org.chromium.ui.base.PageTransition;
-import org.json.JSONObject;
-import java.util.List;
import java.util.concurrent.TimeoutException;
/**
@@ -180,65 +170,6 @@ public class SyncTest extends SyncTestBase {
SyncTestUtil.verifySignedInWithAccount(mContext, account);
}
- @LargeTest
- @Feature({"Sync"})
- public void testUploadTypedUrl() throws Exception {
- setupTestAccountAndSignInToSync(CLIENT_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);
- }
-
- @LargeTest
- @Feature({"Sync"})
- public void testDownloadTypedUrl() throws Exception {
- setupTestAccountAndSignInToSync(CLIENT_ID);
- assertEquals("No typed URLs should exist on the client by default.",
- 0, SyncTestUtil.getLocalData(mContext, "Typed URLs").size());
-
- String url = "data:text,testDownloadTypedUrl";
- EntitySpecifics specifics = new EntitySpecifics();
- specifics.typedUrl = new TypedUrlSpecifics();
- specifics.typedUrl.url = url;
- specifics.typedUrl.title = url;
- specifics.typedUrl.visits = new long[]{1L};
- specifics.typedUrl.visitTransitions = new int[]{SyncEnums.TYPED};
- mFakeServerHelper.injectUniqueClientEntity(url /* name */, specifics);
-
- SyncTestUtil.triggerSyncAndWaitForCompletion(mContext);
-
- List<Pair<String, JSONObject>> typedUrls = SyncTestUtil.getLocalData(
- mContext, "Typed URLs");
- assertEquals("Only the injected typed URL should exist on the client.",
- 1, typedUrls.size());
- JSONObject typedUrl = typedUrls.get(0).second;
- assertEquals("The wrong URL was found for the typed URL.", url, typedUrl.getString("url"));
- }
-
private static ContentViewCore getContentViewCore(ChromeShellActivity activity) {
return activity.getActiveContentViewCore();
}
« no previous file with comments | « no previous file | chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698