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.test.util.parameters; | 5 package org.chromium.chrome.test.util.parameters; |
6 | 6 |
7 import android.app.Instrumentation; | 7 import android.app.Instrumentation; |
8 | 8 |
9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
10 import org.chromium.base.test.util.parameter.BaseParameter; | 10 import org.chromium.base.test.util.parameter.BaseParameter; |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 public AddFakeAccountToAppParameter(Parameter.Reader parameterReader, | 34 public AddFakeAccountToAppParameter(Parameter.Reader parameterReader, |
35 Instrumentation instrumentation) { | 35 Instrumentation instrumentation) { |
36 super(PARAMETER_TAG, parameterReader); | 36 super(PARAMETER_TAG, parameterReader); |
37 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 37 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
38 @Override | 38 @Override |
39 public void run() { | 39 public void run() { |
40 ProcessInitializationHandler.getInstance().initializePreNative()
; | 40 ProcessInitializationHandler.getInstance().initializePreNative()
; |
41 } | 41 } |
42 }); | 42 }); |
43 mSigninController = ChromeSigninController.get(instrumentation.getTarget
Context()); | 43 mSigninController = ChromeSigninController.get(); |
44 mSigninUtil = new ChromeSigninUtils(instrumentation); | 44 mSigninUtil = new ChromeSigninUtils(instrumentation); |
45 } | 45 } |
46 | 46 |
47 @Override | 47 @Override |
48 public void setUp() { | 48 public void setUp() { |
49 String username = getStringArgument(ARGUMENT.USERNAME, ARGUMENT.DEFAULT.
USERNAME); | 49 String username = getStringArgument(ARGUMENT.USERNAME, ARGUMENT.DEFAULT.
USERNAME); |
50 | 50 |
51 mSigninController.setSignedInAccountName(null); | 51 mSigninController.setSignedInAccountName(null); |
52 mSigninUtil.addAccountToApp(username); | 52 mSigninUtil.addAccountToApp(username); |
53 } | 53 } |
54 | 54 |
55 @Override | 55 @Override |
56 public void tearDown() { | 56 public void tearDown() { |
57 mSigninController.setSignedInAccountName(null); | 57 mSigninController.setSignedInAccountName(null); |
58 } | 58 } |
59 | 59 |
60 /** | 60 /** |
61 * Only affects Java tests. | 61 * Only affects Java tests. |
62 * | 62 * |
63 * @return {@code true} if an account is on the app, {@code false} otherwise
. | 63 * @return {@code true} if an account is on the app, {@code false} otherwise
. |
64 */ | 64 */ |
65 public boolean isSignedIn() { | 65 public boolean isSignedIn() { |
66 return mSigninController.isSignedIn(); | 66 return mSigninController.isSignedIn(); |
67 } | 67 } |
68 } | 68 } |
OLD | NEW |