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

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

Issue 862113005: Create a Android Sync integration test for typed URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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 c7d254a1f0a19b8b36f66bf5a2c587dbf6f3def0..8de5ee3a08f033c60d0568c504000f1acd267125 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
@@ -24,11 +24,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.internal_api.pub.base.ModelType;
import org.chromium.sync.notifier.SyncStatusHelper;
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;
@@ -181,6 +184,37 @@ 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(FakeServerHelper.get().verifyEntityCountByTypeAndName(0, ModelType.TYPED_URL,
nyquist 2015/01/24 01:54:41 Could you add a message to this assert?
pval...(no longer on Chromium) 2015/01/27 22:14:47 Done.
+ 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 FakeServerHelper.get().verifyEntityCountByTypeAndName(1, ModelType.TYPED_URL,
+ urlToLoad);
+ }
+ }, SyncTestUtil.UI_TIMEOUT_MS, SyncTestUtil.CHECK_INTERVAL_MS);
+
+ assertTrue(synced);
nyquist 2015/01/24 01:54:41 Could you add a message to this assert?
pval...(no longer on Chromium) 2015/01/27 22:14:47 Done.
+ }
+
private void setupTestAccountAndSignInToSync(
final String syncClientIdentifier)
throws InterruptedException {

Powered by Google App Engine
This is Rietveld 408576698