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

Unified Diff: sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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: sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java
diff --git a/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java b/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java
deleted file mode 100644
index c88ba72f975359df2fc5a87886c547490a25e229..0000000000000000000000000000000000000000
--- a/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.sync.notifier;
-
-import android.accounts.Account;
-import android.test.InstrumentationTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import com.google.ipc.invalidation.external.client.types.ObjectId;
-
-import org.chromium.base.CollectionUtil;
-import org.chromium.base.test.util.Feature;
-
-import java.util.Arrays;
-import java.util.Set;
-
-/**
- * Tests for the {@link InvalidationPreferences}.
- *
- * @author dsmyers@google.com (Daniel Myers)
- */
-public class InvalidationPreferencesTest extends InstrumentationTestCase {
- @SmallTest
- @Feature({"Sync"})
- public void testReadMissingData() {
- /*
- * Test plan: read saved state from empty preferences. Verify that null is returned.
- */
- InvalidationPreferences invPreferences = new InvalidationPreferences();
- assertNull(invPreferences.getSavedSyncedAccount());
- assertNull(invPreferences.getSavedSyncedTypes());
- assertNull(invPreferences.getSavedObjectIds());
- assertNull(invPreferences.getInternalNotificationClientState());
- }
-
- @SmallTest
- @Feature({"Sync"})
- public void testReadWriteAndReadData() {
- /*
- * Test plan: write and read back saved state. Verify that the returned state is what
- * was written.
- */
- InvalidationPreferences invPreferences = new InvalidationPreferences();
- InvalidationPreferences.EditContext editContext = invPreferences.edit();
-
- // Write mix of valid and invalid types to disk to test that preferences are not
- // interpreting the data. Invalid types should never be written to disk in practice.
- Set<String> syncTypes = CollectionUtil.newHashSet("BOOKMARK", "INVALID");
- Set<ObjectId> objectIds = CollectionUtil.newHashSet(
- ObjectId.newInstance(1, "obj1".getBytes()),
- ObjectId.newInstance(2, "obj2".getBytes()));
- Account account = new Account("test@example.com", "bogus");
- byte[] internalClientState = new byte[]{100, 101, 102};
- invPreferences.setSyncTypes(editContext, syncTypes);
- invPreferences.setObjectIds(editContext, objectIds);
- invPreferences.setAccount(editContext, account);
- invPreferences.setInternalNotificationClientState(editContext, internalClientState);
-
- // Nothing should yet have been written.
- assertNull(invPreferences.getSavedSyncedAccount());
- assertNull(invPreferences.getSavedSyncedTypes());
- assertNull(invPreferences.getSavedObjectIds());
-
- // Write the new data and verify that they are correctly read back.
- invPreferences.commit(editContext);
- assertEquals(account, invPreferences.getSavedSyncedAccount());
- assertEquals(syncTypes, invPreferences.getSavedSyncedTypes());
- assertEquals(objectIds, invPreferences.getSavedObjectIds());
- assertTrue(Arrays.equals(
- internalClientState, invPreferences.getInternalNotificationClientState()));
- }
-}

Powered by Google App Engine
This is Rietveld 408576698