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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseActivityTest.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.sync.ui; 5 package org.chromium.chrome.browser.sync.ui;
6 6
7 import android.app.Instrumentation.ActivityMonitor; 7 import android.app.Instrumentation.ActivityMonitor;
8 import android.content.ComponentName; 8 import android.content.ComponentName;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 @Feature({"Sync"}) 63 @Feature({"Sync"})
64 @RetryOnFailure 64 @RetryOnFailure
65 public void testCallbackAfterBackgrounded() throws Exception { 65 public void testCallbackAfterBackgrounded() throws Exception {
66 InstrumentationRegistry.getInstrumentation().waitForIdleSync(); 66 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
67 SigninTestUtil.addAndSignInTestAccount(); 67 SigninTestUtil.addAndSignInTestAccount();
68 68
69 // Override before creating the activity so we know initialized is false . 69 // Override before creating the activity so we know initialized is false .
70 overrideProfileSyncService(); 70 overrideProfileSyncService();
71 71
72 // PassphraseActivity won't start if an account isn't set. 72 // PassphraseActivity won't start if an account isn't set.
73 Assert.assertNotNull(ChromeSigninController.get(mContext).getSignedInAcc ountName()); 73 Assert.assertNotNull(ChromeSigninController.get().getSignedInAccountName ());
74 74
75 // Create the activity. 75 // Create the activity.
76 final PassphraseActivity activity = launchPassphraseActivity(); 76 final PassphraseActivity activity = launchPassphraseActivity();
77 Assert.assertNotNull(activity); 77 Assert.assertNotNull(activity);
78 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 78 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
79 @Override 79 @Override
80 public void run() { 80 public void run() {
81 // Fake backgrounding the activity. 81 // Fake backgrounding the activity.
82 Bundle bundle = new Bundle(); 82 Bundle bundle = new Bundle();
83 InstrumentationRegistry.getInstrumentation().callActivityOnPause (activity); 83 InstrumentationRegistry.getInstrumentation().callActivityOnPause (activity);
(...skipping 26 matching lines...) Expand all
110 private void overrideProfileSyncService() { 110 private void overrideProfileSyncService() {
111 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 111 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
112 @Override 112 @Override
113 public void run() { 113 public void run() {
114 // PSS has to be constructed on the UI thread. 114 // PSS has to be constructed on the UI thread.
115 ProfileSyncService.overrideForTests(new FakeProfileSyncService() ); 115 ProfileSyncService.overrideForTests(new FakeProfileSyncService() );
116 } 116 }
117 }); 117 });
118 } 118 }
119 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698