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

Unified Diff: components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java

Issue 1462953004: Unit tests for importing prefs from the Java side implemented (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile error fix Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/components_tests.gyp ('k') | components/variations/android/variations_seed_bridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
diff --git a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
index 2b5a5bed5d4c5447b915c9322a1f0259dd836818..64e2877ae15234ce8ac9dcd90629307bc68c151d 100644
--- a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
+++ b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
@@ -16,26 +16,28 @@ import org.chromium.base.annotations.CalledByNative;
* in SharedPreferences and to get the seed from there. To store raw seed data class serializes
* byte[] to Base64 encoded string and decodes this string before passing to C++ side.
*/
-public final class VariationsSeedBridge {
- private static final String VARIATIONS_FIRST_RUN_SEED_BASE64 = "variations_seed_base64";
- private static final String VARIATIONS_FIRST_RUN_SEED_SIGNATURE = "variations_seed_signature";
- private static final String VARIATIONS_FIRST_RUN_SEED_COUNTRY = "variations_seed_country";
- private static final String VARIATIONS_FIRST_RUN_SEED_DATE = "variations_seed_date";
- private static final String VARIATIONS_FIRST_RUN_SEED_IS_GZIP_COMPRESSED =
+public class VariationsSeedBridge {
+ protected static final String VARIATIONS_FIRST_RUN_SEED_BASE64 = "variations_seed_base64";
+ protected static final String VARIATIONS_FIRST_RUN_SEED_SIGNATURE = "variations_seed_signature";
+ protected static final String VARIATIONS_FIRST_RUN_SEED_COUNTRY = "variations_seed_country";
+ protected static final String VARIATIONS_FIRST_RUN_SEED_DATE = "variations_seed_date";
+ protected static final String VARIATIONS_FIRST_RUN_SEED_IS_GZIP_COMPRESSED =
"variations_seed_is_gzip_compressed";
// This pref is used to store information about successful seed storing on the C++ side, in
// order to not fetch the seed again.
- private static final String VARIATIONS_FIRST_RUN_SEED_NATIVE_STORED =
+ protected static final String VARIATIONS_FIRST_RUN_SEED_NATIVE_STORED =
"variations_seed_native_stored";
- private static String getVariationsFirstRunSeedPref(Context context, String prefName) {
+ protected static String getVariationsFirstRunSeedPref(Context context, String prefName) {
return PreferenceManager.getDefaultSharedPreferences(context).getString(prefName, "");
}
/**
* Stores variations seed data (raw data, seed signature and country code) in SharedPreferences.
+ * CalledByNative attribute is used by unit tests code to set test data.
*/
+ @CalledByNative
public static void setVariationsFirstRunSeed(Context context, byte[] rawSeed, String signature,
String country, String date, boolean isGzipCompressed) {
PreferenceManager.getDefaultSharedPreferences(context)
@@ -56,6 +58,8 @@ public final class VariationsSeedBridge {
.remove(VARIATIONS_FIRST_RUN_SEED_BASE64)
.remove(VARIATIONS_FIRST_RUN_SEED_SIGNATURE)
.remove(VARIATIONS_FIRST_RUN_SEED_COUNTRY)
+ .remove(VARIATIONS_FIRST_RUN_SEED_DATE)
+ .remove(VARIATIONS_FIRST_RUN_SEED_IS_GZIP_COMPRESSED)
.apply();
}
« no previous file with comments | « components/components_tests.gyp ('k') | components/variations/android/variations_seed_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698