| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.support.test.filters.SmallTest; | 8 import android.support.test.filters.SmallTest; |
| 9 import android.test.InstrumentationTestCase; | 9 import android.test.InstrumentationTestCase; |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 mPrecachingStarted = true; | 62 mPrecachingStarted = true; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 @Override | 66 @Override |
| 67 protected void rescheduleBackgroundSyncTasksOnUpgrade() {} | 67 protected void rescheduleBackgroundSyncTasksOnUpgrade() {} |
| 68 | 68 |
| 69 @Override | 69 @Override |
| 70 protected void reschedulePrecacheTasksOnUpgrade() {} | 70 protected void reschedulePrecacheTasksOnUpgrade() {} |
| 71 | 71 |
| 72 @Override |
| 73 protected void rescheduleOfflinePagesTasksOnUpgrade() {} |
| 74 |
| 72 // Posts an assertion task to the UI thread. Since this is only called a
fter the call | 75 // Posts an assertion task to the UI thread. Since this is only called a
fter the call |
| 73 // to onRunTask, it will be enqueued after any possible call to launchBr
owser, and we | 76 // to onRunTask, it will be enqueued after any possible call to launchBr
owser, and we |
| 74 // can reliably check whether launchBrowser was called. | 77 // can reliably check whether launchBrowser was called. |
| 75 protected void checkExpectations(final boolean expectedLaunchBrowser, | 78 protected void checkExpectations(final boolean expectedLaunchBrowser, |
| 76 final boolean expectedPrecacheStarted, final boolean expectedFet
chSnippets, | 79 final boolean expectedPrecacheStarted, final boolean expectedFet
chSnippets, |
| 77 final boolean expectedRescheduleFetching) { | 80 final boolean expectedRescheduleFetching) { |
| 78 ThreadUtils.runOnUiThread(new Runnable() { | 81 ThreadUtils.runOnUiThread(new Runnable() { |
| 79 @Override | 82 @Override |
| 80 public void run() { | 83 public void run() { |
| 81 assertEquals("StartedService", expectedLaunchBrowser, mDidLa
unchBrowser); | 84 assertEquals("StartedService", expectedLaunchBrowser, mDidLa
unchBrowser); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 deleteSnippetsLauncherInstance(); | 215 deleteSnippetsLauncherInstance(); |
| 213 // Set the pref indicating that fetching was scheduled before. | 216 // Set the pref indicating that fetching was scheduled before. |
| 214 ContextUtils.getAppSharedPreferences() | 217 ContextUtils.getAppSharedPreferences() |
| 215 .edit() | 218 .edit() |
| 216 .putBoolean(SnippetsLauncher.PREF_IS_SCHEDULED, true) | 219 .putBoolean(SnippetsLauncher.PREF_IS_SCHEDULED, true) |
| 217 .apply(); | 220 .apply(); |
| 218 | 221 |
| 219 startOnInitializeTasksAndVerify(/*shouldStart=*/true, /*shouldReschedule
=*/true); | 222 startOnInitializeTasksAndVerify(/*shouldStart=*/true, /*shouldReschedule
=*/true); |
| 220 } | 223 } |
| 221 } | 224 } |
| OLD | NEW |