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

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: Fixes according to code review comments 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
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..2f60fd4bf20ff2e63c1ef4fb930e31aa9d9021d0 100644
--- a/components/variations/variations_seed_store_unittest.cc
+++ b/components/variations/variations_seed_store_unittest.cc
@@ -12,6 +12,11 @@
#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"
+#include "components/variations/android/variations_seed_bridge_test.h"
+#endif // OS_ANDROID
+
namespace variations {
namespace {
@@ -378,4 +383,38 @@ 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::SetTestData(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

Powered by Google App Engine
This is Rietveld 408576698