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

Side by Side Diff: chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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
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(mContext).setSignedInAccountName("test@exampl e.com"); 137 ChromeSigninController.get().setSignedInAccountName("test@example.com");
138 AndroidSyncSettings.updateAccount( 138 AndroidSyncSettings.updateAccount(mContext, ChromeSigninController.get() .getSignedInUser());
139 mContext, ChromeSigninController.get(mContext).getSignedInUser() );
140 AndroidSyncSettings.enableChromeSync(mContext); 139 AndroidSyncSettings.enableChromeSync(mContext);
141 } 140 }
142 141
143 /** 142 /**
144 * Verify the intent sent by InvalidationController#stop(). 143 * Verify the intent sent by InvalidationController#stop().
145 */ 144 */
146 @Test 145 @Test
147 @Feature({"Sync"}) 146 @Feature({"Sync"})
148 public void testStop() throws Exception { 147 public void testStop() throws Exception {
149 InvalidationController controller = new InvalidationController(mContext, true, false); 148 InvalidationController controller = new InvalidationController(mContext, true, false);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 * intent. 497 * intent.
499 */ 498 */
500 private static Set<String> getRegisterIntentRegisterTypes(Intent intent) { 499 private static Set<String> getRegisterIntentRegisterTypes(Intent intent) {
501 Set<String> registeredTypes = new HashSet<String>(); 500 Set<String> registeredTypes = new HashSet<String>();
502 registeredTypes.addAll( 501 registeredTypes.addAll(
503 intent.getStringArrayListExtra(InvalidationIntentProtocol.EXTRA_ REGISTERED_TYPES)); 502 intent.getStringArrayListExtra(InvalidationIntentProtocol.EXTRA_ REGISTERED_TYPES));
504 return registeredTypes; 503 return registeredTypes;
505 } 504 }
506 505
507 } 506 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698