OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.invalidation; | 5 package org.chromium.chrome.browser.invalidation; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.test.UiThreadTest; | 8 import android.test.UiThreadTest; |
9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 @Override | 30 @Override |
31 protected void setUp() throws Exception { | 31 protected void setUp() throws Exception { |
32 super.setUp(); | 32 super.setUp(); |
33 startChromeBrowserProcessSync(getInstrumentation().getTargetContext()); | 33 startChromeBrowserProcessSync(getInstrumentation().getTargetContext()); |
34 mContext = new IntentSavingContext(getInstrumentation().getTargetContext
()); | 34 mContext = new IntentSavingContext(getInstrumentation().getTargetContext
()); |
35 // We don't want to use the system content resolver, so we override it. | 35 // We don't want to use the system content resolver, so we override it. |
36 MockSyncContentResolverDelegate delegate = new MockSyncContentResolverDe
legate(); | 36 MockSyncContentResolverDelegate delegate = new MockSyncContentResolverDe
legate(); |
37 // Android master sync can safely always be on. | 37 // Android master sync can safely always be on. |
38 delegate.setMasterSyncAutomatically(true); | 38 delegate.setMasterSyncAutomatically(true); |
39 AndroidSyncSettings.overrideAndroidSyncSettingsForTests(mContext, delega
te); | 39 AndroidSyncSettings.overrideForTests(mContext, delegate); |
40 } | 40 } |
41 | 41 |
42 @SmallTest | 42 @SmallTest |
43 @UiThreadTest | 43 @UiThreadTest |
44 @Feature({"Sync"}) | 44 @Feature({"Sync"}) |
45 public void testSetRegisteredObjectIds() { | 45 public void testSetRegisteredObjectIds() { |
46 InvalidationService service = InvalidationServiceFactory.getForTest(mCon
text); | 46 InvalidationService service = InvalidationServiceFactory.getForTest(mCon
text); |
47 ObjectId bookmark = ModelType.BOOKMARK.toObjectId(); | 47 ObjectId bookmark = ModelType.BOOKMARK.toObjectId(); |
48 service.setRegisteredObjectIds(new int[] {1, 2, bookmark.getSource()}, | 48 service.setRegisteredObjectIds(new int[] {1, 2, bookmark.getSource()}, |
49 new String[] {"a", "b", new String(boo
kmark.getName())}); | 49 new String[] {"a", "b", new String(boo
kmark.getName())}); |
(...skipping 17 matching lines...) Expand all Loading... |
67 /** | 67 /** |
68 * Asserts that {@code intent} is destined for the correct component. | 68 * Asserts that {@code intent} is destined for the correct component. |
69 */ | 69 */ |
70 private static void validateIntentComponent(Intent intent) { | 70 private static void validateIntentComponent(Intent intent) { |
71 assertNotNull(intent.getComponent()); | 71 assertNotNull(intent.getComponent()); |
72 assertEquals(InvalidationClientService.class.getName(), | 72 assertEquals(InvalidationClientService.class.getName(), |
73 intent.getComponent().getClassName()); | 73 intent.getComponent().getClassName()); |
74 } | 74 } |
75 | 75 |
76 } | 76 } |
OLD | NEW |