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 static org.hamcrest.CoreMatchers.equalTo; | 7 import static org.hamcrest.CoreMatchers.equalTo; |
8 import static org.hamcrest.CoreMatchers.hasItem; | 8 import static org.hamcrest.CoreMatchers.hasItem; |
9 import static org.junit.Assert.assertFalse; | 9 import static org.junit.Assert.assertFalse; |
10 import static org.junit.Assert.assertThat; | 10 import static org.junit.Assert.assertThat; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 import java.io.IOException; | 51 import java.io.IOException; |
52 import java.io.ObjectInputStream; | 52 import java.io.ObjectInputStream; |
53 import java.util.ArrayList; | 53 import java.util.ArrayList; |
54 import java.util.Arrays; | 54 import java.util.Arrays; |
55 import java.util.concurrent.CountDownLatch; | 55 import java.util.concurrent.CountDownLatch; |
56 | 56 |
57 /** | 57 /** |
58 * Unit tests for {@link org.chromium.chrome.browser.ChromeBackupAgent}. | 58 * Unit tests for {@link org.chromium.chrome.browser.ChromeBackupAgent}. |
59 */ | 59 */ |
60 @RunWith(LocalRobolectricTestRunner.class) | 60 @RunWith(LocalRobolectricTestRunner.class) |
61 @Config(manifest = Config.NONE, application = BaseChromiumApplication.class) | 61 @Config(manifest = Config.NONE, application = BaseChromiumApplication.class, sdk
= 21) |
62 public class ChromeBackupAgentTest { | 62 public class ChromeBackupAgentTest { |
63 private Context mContext; | 63 private Context mContext; |
64 private ChromeBackupAgent mAgent; | 64 private ChromeBackupAgent mAgent; |
65 private AsyncInitTaskRunner mTaskRunner; | 65 private AsyncInitTaskRunner mTaskRunner; |
66 | 66 |
67 private void setUpTestPrefs(SharedPreferences prefs) { | 67 private void setUpTestPrefs(SharedPreferences prefs) { |
68 SharedPreferences.Editor editor = prefs.edit(); | 68 SharedPreferences.Editor editor = prefs.edit(); |
69 editor.putBoolean(FirstRunStatus.FIRST_RUN_FLOW_COMPLETE, true); | 69 editor.putBoolean(FirstRunStatus.FIRST_RUN_FLOW_COMPLETE, true); |
70 editor.putBoolean(FirstRunSignInProcessor.FIRST_RUN_FLOW_SIGNIN_SETUP, f
alse); | 70 editor.putBoolean(FirstRunSignInProcessor.FIRST_RUN_FLOW_SIGNIN_SETUP, f
alse); |
71 editor.putString(ChromeSigninController.SIGNED_IN_ACCOUNT_KEY, "user1"); | 71 editor.putString(ChromeSigninController.SIGNED_IN_ACCOUNT_KEY, "user1"); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 verify(mAgent, never()).nativeSetBoolBackupPrefs(any(String[].class), an
y(boolean[].class)); | 411 verify(mAgent, never()).nativeSetBoolBackupPrefs(any(String[].class), an
y(boolean[].class)); |
412 verify(mTaskRunner) | 412 verify(mTaskRunner) |
413 .startBackgroundTasks( | 413 .startBackgroundTasks( |
414 false /* allocateChildConnection */, true /* initVariati
onSeed */); | 414 false /* allocateChildConnection */, true /* initVariati
onSeed */); |
415 // The test mocks out everything that forces the AsyncTask used by PathU
tils setup to | 415 // The test mocks out everything that forces the AsyncTask used by PathU
tils setup to |
416 // complete. If it isn't completed before the test exits Robolectric cra
shes with a null | 416 // complete. If it isn't completed before the test exits Robolectric cra
shes with a null |
417 // pointer exception (although the test passes). Force it to complete by
getting some data. | 417 // pointer exception (although the test passes). Force it to complete by
getting some data. |
418 PathUtils.getDataDirectory(); | 418 PathUtils.getDataDirectory(); |
419 } | 419 } |
420 } | 420 } |
OLD | NEW |