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

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: Added unit test check if prefs are actually empty after calling ClearJavaFirstRunPrefs() function 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..770dbcd58a3d198470bd373d88ad0585914dcb6d 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,32 @@ TEST(VariationsSeedStoreTest, ApplyDeltaPatch) {
EXPECT_EQ(after_seed_data, output);
}
+#if defined(OS_ANDROID)
+TEST(VariationsSeedStoreTest, ImportFirstRunJavaSeed) {
+ android::SetTestData();
+ 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(seed_data, "raw_seed_data_test");
Alexei Svitkine (slow) 2015/11/20 16:28:28 Nit: Expected value should be on the left
Alexander Agulenko 2015/11/20 17:33:31 Done.
+ EXPECT_EQ(seed_signature, "seed_signature_test");
+ EXPECT_EQ(seed_country, "seed_country_code_test");
+ EXPECT_EQ(response_date, "seed_response_date_test");
+ EXPECT_EQ(is_gzip_compressed, true);
+ 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, "");
+ // TODO(agulenko): uncomment lines below after landing CL with fixing bug
+ // about missing date and gzip_compressed pref clearance.
+ /* EXPECT_EQ(response_date, "");
+ EXPECT_EQ(is_gzip_compressed, false); */
+}
+#endif // OS_ANDROID
+
} // namespace variations

Powered by Google App Engine
This is Rietveld 408576698