OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.accounts.Account; | 7 import android.accounts.Account; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 ModelTypeHelper.toNotificationType(ModelType.SESSIONS)); | 127 ModelTypeHelper.toNotificationType(ModelType.SESSIONS)); |
128 mNonSessionTypes = CollectionUtil.newHashSet(ModelTypeHelper.toNotificat
ionType( | 128 mNonSessionTypes = CollectionUtil.newHashSet(ModelTypeHelper.toNotificat
ionType( |
129 ModelType.BOOKMARKS)); | 129 ModelType.BOOKMARKS)); |
130 | 130 |
131 // We don't want to use the system content resolver, so we override it. | 131 // We don't want to use the system content resolver, so we override it. |
132 MockSyncContentResolverDelegate delegate = new MockSyncContentResolverDe
legate(); | 132 MockSyncContentResolverDelegate delegate = new MockSyncContentResolverDe
legate(); |
133 // Android master sync can safely always be on. | 133 // Android master sync can safely always be on. |
134 delegate.setMasterSyncAutomatically(true); | 134 delegate.setMasterSyncAutomatically(true); |
135 AndroidSyncSettings.overrideForTests(mContext, delegate); | 135 AndroidSyncSettings.overrideForTests(mContext, delegate); |
136 | 136 |
137 ChromeSigninController.get().setSignedInAccountName("test@example.com"); | 137 ChromeSigninController.get(mContext).setSignedInAccountName("test@exampl
e.com"); |
138 AndroidSyncSettings.updateAccount(mContext, ChromeSigninController.get()
.getSignedInUser()); | 138 AndroidSyncSettings.updateAccount( |
| 139 mContext, ChromeSigninController.get(mContext).getSignedInUser()
); |
139 AndroidSyncSettings.enableChromeSync(mContext); | 140 AndroidSyncSettings.enableChromeSync(mContext); |
140 } | 141 } |
141 | 142 |
142 /** | 143 /** |
143 * Verify the intent sent by InvalidationController#stop(). | 144 * Verify the intent sent by InvalidationController#stop(). |
144 */ | 145 */ |
145 @Test | 146 @Test |
146 @Feature({"Sync"}) | 147 @Feature({"Sync"}) |
147 public void testStop() throws Exception { | 148 public void testStop() throws Exception { |
148 InvalidationController controller = new InvalidationController(mContext,
true, false); | 149 InvalidationController controller = new InvalidationController(mContext,
true, false); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 * intent. | 498 * intent. |
498 */ | 499 */ |
499 private static Set<String> getRegisterIntentRegisterTypes(Intent intent) { | 500 private static Set<String> getRegisterIntentRegisterTypes(Intent intent) { |
500 Set<String> registeredTypes = new HashSet<String>(); | 501 Set<String> registeredTypes = new HashSet<String>(); |
501 registeredTypes.addAll( | 502 registeredTypes.addAll( |
502 intent.getStringArrayListExtra(InvalidationIntentProtocol.EXTRA_
REGISTERED_TYPES)); | 503 intent.getStringArrayListExtra(InvalidationIntentProtocol.EXTRA_
REGISTERED_TYPES)); |
503 return registeredTypes; | 504 return registeredTypes; |
504 } | 505 } |
505 | 506 |
506 } | 507 } |
OLD | NEW |