| 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.nullValue; | 8 import static org.hamcrest.CoreMatchers.nullValue; |
| 9 import static org.junit.Assert.assertThat; | 9 import static org.junit.Assert.assertThat; |
| 10 | 10 |
| 11 import android.accounts.Account; | 11 import android.accounts.Account; |
| 12 import android.accounts.AccountManager; | 12 import android.accounts.AccountManager; |
| 13 import android.content.Context; | 13 import android.content.Context; |
| 14 import android.content.SharedPreferences; | 14 import android.content.SharedPreferences; |
| 15 import android.preference.PreferenceManager; | 15 import android.preference.PreferenceManager; |
| 16 | 16 |
| 17 import org.chromium.base.ContextUtils; |
| 17 import org.chromium.testing.local.LocalRobolectricTestRunner; | 18 import org.chromium.testing.local.LocalRobolectricTestRunner; |
| 19 import org.junit.Before; |
| 18 import org.junit.Test; | 20 import org.junit.Test; |
| 19 import org.junit.runner.RunWith; | 21 import org.junit.runner.RunWith; |
| 20 import org.robolectric.Robolectric; | 22 import org.robolectric.Robolectric; |
| 21 import org.robolectric.annotation.Config; | 23 import org.robolectric.annotation.Config; |
| 22 | 24 |
| 23 /** | 25 /** |
| 24 * Unit tests for {@link org.chromium.chrome.browser.ChromeBackupAgent}. | 26 * Unit tests for {@link org.chromium.chrome.browser.ChromeBackupAgent}. |
| 25 */ | 27 */ |
| 26 @RunWith(LocalRobolectricTestRunner.class) | 28 @RunWith(LocalRobolectricTestRunner.class) |
| 27 @Config(manifest = Config.NONE) | 29 @Config(manifest = Config.NONE) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 97 |
| 96 new ChromeTestBackupAgent().onRestoreFinished(); | 98 new ChromeTestBackupAgent().onRestoreFinished(); |
| 97 | 99 |
| 98 // Check that we haven't restored any preferences | 100 // Check that we haven't restored any preferences |
| 99 assertThat(sharedPrefs.getBoolean("crash_dump_upload", true), equalTo(tr
ue)); | 101 assertThat(sharedPrefs.getBoolean("crash_dump_upload", true), equalTo(tr
ue)); |
| 100 assertThat(sharedPrefs.getString("google.services.username", null), null
Value()); | 102 assertThat(sharedPrefs.getString("google.services.username", null), null
Value()); |
| 101 assertThat(sharedPrefs.getString("junk", null), nullValue()); | 103 assertThat(sharedPrefs.getString("junk", null), nullValue()); |
| 102 assertThat(sharedPrefs.getString("first_run_signin_account_name", null),
nullValue()); | 104 assertThat(sharedPrefs.getString("first_run_signin_account_name", null),
nullValue()); |
| 103 } | 105 } |
| 104 } | 106 } |
| OLD | NEW |