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

Unified Diff: components/variations/variations_seed_store_unittest.cc

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/variations/android/variations_seed_bridge.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/variations_seed_store_unittest.cc
diff --git a/components/variations/variations_seed_store_unittest.cc b/components/variations/variations_seed_store_unittest.cc
index ab7f506e18d6b6181638b0bb3f506b30afe7ebb6..419784f966fe5c9670aa8a59235e22685f90200f 100644
--- a/components/variations/variations_seed_store_unittest.cc
+++ b/components/variations/variations_seed_store_unittest.cc
@@ -12,6 +12,10 @@
#include "components/variations/proto/variations_seed.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_ANDROID)
+#include "components/variations/android/variations_seed_bridge.h"
+#endif // OS_ANDROID
+
namespace variations {
namespace {
@@ -378,4 +382,39 @@ TEST(VariationsSeedStoreTest, ApplyDeltaPatch) {
EXPECT_EQ(after_seed_data, output);
}
+#if defined(OS_ANDROID)
+TEST(VariationsSeedStoreTest, ImportFirstRunJavaSeed) {
+ const std::string test_seed_data = "raw_seed_data_test";
+ const std::string test_seed_signature = "seed_signature_test";
+ const std::string test_seed_country = "seed_country_code_test";
+ const std::string test_response_date = "seed_response_date_test";
+ const bool test_is_gzip_compressed = true;
+ android::SetJavaFirstRunPrefsForTesting(test_seed_data, test_seed_signature,
+ test_seed_country, test_response_date,
+ test_is_gzip_compressed);
+
+ std::string seed_data;
+ std::string seed_signature;
+ std::string seed_country;
+ std::string response_date;
+ bool is_gzip_compressed;
+ android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country,
+ &response_date, &is_gzip_compressed);
+ EXPECT_EQ(test_seed_data, seed_data);
+ EXPECT_EQ(test_seed_signature, seed_signature);
+ EXPECT_EQ(test_seed_country, seed_country);
+ EXPECT_EQ(test_response_date, response_date);
+ EXPECT_EQ(test_is_gzip_compressed, is_gzip_compressed);
+
+ android::ClearJavaFirstRunPrefs();
+ android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country,
+ &response_date, &is_gzip_compressed);
+ EXPECT_EQ("", seed_data);
+ EXPECT_EQ("", seed_signature);
+ EXPECT_EQ("", seed_country);
+ EXPECT_EQ("", response_date);
+ EXPECT_FALSE(is_gzip_compressed);
+}
+#endif // OS_ANDROID
+
} // namespace variations
« no previous file with comments | « components/variations/android/variations_seed_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698