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

Side by Side Diff: components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerHelperTest.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.components.signin.test; 5 package org.chromium.components.signin.test;
6 6
7 import android.accounts.Account; 7 import android.accounts.Account;
8 import android.content.Context; 8 import android.content.Context;
9 import android.support.test.filters.SmallTest; 9 import android.support.test.filters.SmallTest;
10 import android.test.InstrumentationTestCase; 10 import android.test.InstrumentationTestCase;
(...skipping 10 matching lines...) Expand all
21 private MockAccountManager mAccountManager; 21 private MockAccountManager mAccountManager;
22 private AccountManagerHelper mHelper; 22 private AccountManagerHelper mHelper;
23 23
24 @Override 24 @Override
25 protected void setUp() throws Exception { 25 protected void setUp() throws Exception {
26 super.setUp(); 26 super.setUp();
27 27
28 Context context = getInstrumentation().getTargetContext(); 28 Context context = getInstrumentation().getTargetContext();
29 mAccountManager = new MockAccountManager(context, context); 29 mAccountManager = new MockAccountManager(context, context);
30 AccountManagerHelper.overrideAccountManagerHelperForTests(context, mAcco untManager); 30 AccountManagerHelper.overrideAccountManagerHelperForTests(context, mAcco untManager);
31 mHelper = AccountManagerHelper.get(context); 31 mHelper = AccountManagerHelper.get();
32 } 32 }
33 33
34 @SmallTest 34 @SmallTest
35 public void testCanonicalAccount() throws InterruptedException { 35 public void testCanonicalAccount() throws InterruptedException {
36 addTestAccount("test@gmail.com", "password"); 36 addTestAccount("test@gmail.com", "password");
37 37
38 assertTrue(hasAccountForName("test@gmail.com")); 38 assertTrue(hasAccountForName("test@gmail.com"));
39 assertTrue(hasAccountForName("Test@gmail.com")); 39 assertTrue(hasAccountForName("Test@gmail.com"));
40 assertTrue(hasAccountForName("te.st@gmail.com")); 40 assertTrue(hasAccountForName("te.st@gmail.com"));
41 } 41 }
(...skipping 17 matching lines...) Expand all
59 mAccountManager.addAccountHolderExplicitly(accountHolder.build()); 59 mAccountManager.addAccountHolderExplicitly(accountHolder.build());
60 return account; 60 return account;
61 } 61 }
62 62
63 private boolean hasAccountForName(String accountName) throws InterruptedExce ption { 63 private boolean hasAccountForName(String accountName) throws InterruptedExce ption {
64 SimpleFuture<Boolean> result = new SimpleFuture<Boolean>(); 64 SimpleFuture<Boolean> result = new SimpleFuture<Boolean>();
65 mHelper.hasAccountForName(accountName, result.createCallback()); 65 mHelper.hasAccountForName(accountName, result.createCallback());
66 return result.get(); 66 return result.get();
67 } 67 }
68 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698