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

Side by Side Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtils.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.test.util; 5 package org.chromium.chrome.test.util;
6 6
7 import android.accounts.Account; 7 import android.accounts.Account;
8 import android.accounts.AccountManager; 8 import android.accounts.AccountManager;
9 import android.accounts.AccountManagerCallback; 9 import android.accounts.AccountManagerCallback;
10 import android.accounts.AccountManagerFuture; 10 import android.accounts.AccountManagerFuture;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 /** 54 /**
55 * Adds an account to the app. 55 * Adds an account to the app.
56 * 56 *
57 * @param username the username for the logged in account; must be a Google account. 57 * @param username the username for the logged in account; must be a Google account.
58 */ 58 */
59 public void addAccountToApp(String username) { 59 public void addAccountToApp(String username) {
60 if (TextUtils.isEmpty(username)) { 60 if (TextUtils.isEmpty(username)) {
61 throw new IllegalArgumentException("ERROR: must specify account"); 61 throw new IllegalArgumentException("ERROR: must specify account");
62 } 62 }
63 63
64 if (ChromeSigninController.get(mContext).isSignedIn()) { 64 if (ChromeSigninController.get().isSignedIn()) {
65 ChromeSigninController.get(mContext).setSignedInAccountName(null); 65 ChromeSigninController.get().setSignedInAccountName(null);
66 } 66 }
67 ChromeSigninController.get(mContext).setSignedInAccountName(username); 67 ChromeSigninController.get().setSignedInAccountName(username);
68 } 68 }
69 69
70 /** 70 /**
71 * Adds a fake account to the OS. 71 * Adds a fake account to the OS.
72 */ 72 */
73 public void addFakeAccountToOs(String username, String password) { 73 public void addFakeAccountToOs(String username, String password) {
74 if (TextUtils.isEmpty(username)) { 74 if (TextUtils.isEmpty(username)) {
75 throw new IllegalArgumentException("ERROR: must specify account"); 75 throw new IllegalArgumentException("ERROR: must specify account");
76 } 76 }
77 77
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 */ 220 */
221 private Bundle buildExceptionBundle(Exception e) { 221 private Bundle buildExceptionBundle(Exception e) {
222 Bundle bundle = new Bundle(); 222 Bundle bundle = new Bundle();
223 bundle.putInt(AccountManager.KEY_ERROR_CODE, 223 bundle.putInt(AccountManager.KEY_ERROR_CODE,
224 AccountManager.ERROR_CODE_INVALID_RESPONSE); 224 AccountManager.ERROR_CODE_INVALID_RESPONSE);
225 bundle.putString(AccountManager.KEY_ERROR_MESSAGE, e.toString()); 225 bundle.putString(AccountManager.KEY_ERROR_MESSAGE, e.toString());
226 return bundle; 226 return bundle;
227 } 227 }
228 } 228 }
229 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698