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

Unified Diff: chrome/browser/search/suggestions/suggestions_service_unittest.cc

Issue 341943002: [Android NTP] Logging histograms for users that are part of a control group. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't use the macro Created 6 years, 6 months 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: chrome/browser/search/suggestions/suggestions_service_unittest.cc
diff --git a/chrome/browser/search/suggestions/suggestions_service_unittest.cc b/chrome/browser/search/suggestions/suggestions_service_unittest.cc
index 674d7bc941b4c317cbd4eb517404d3ed5b82a2fe..6d9d47f62a406c86bb5aff2dd82227db305d93c5 100644
--- a/chrome/browser/search/suggestions/suggestions_service_unittest.cc
+++ b/chrome/browser/search/suggestions/suggestions_service_unittest.cc
@@ -122,7 +122,8 @@ class SuggestionsServiceTest : public testing::Test {
// Enables the "ChromeSuggestions.Group1" field trial.
void EnableFieldTrial(const std::string& url,
const std::string& suggestions_suffix,
- const std::string& blacklist_suffix) {
+ const std::string& blacklist_suffix,
+ bool control_group) {
// Clear the existing |field_trial_list_| to avoid firing a DCHECK.
field_trial_list_.reset(NULL);
field_trial_list_.reset(
@@ -132,6 +133,10 @@ class SuggestionsServiceTest : public testing::Test {
std::map<std::string, std::string> params;
params[kSuggestionsFieldTrialStateParam] =
kSuggestionsFieldTrialStateEnabled;
+ if (control_group) {
+ params[kSuggestionsFieldTrialControlParam] =
+ kSuggestionsFieldTrialStateEnabled;
+ }
params[kSuggestionsFieldTrialURLParam] = url;
params[kSuggestionsFieldTrialSuggestionsSuffixParam] = suggestions_suffix;
params[kSuggestionsFieldTrialBlacklistSuffixParam] = blacklist_suffix;
@@ -159,7 +164,7 @@ class SuggestionsServiceTest : public testing::Test {
void FetchSuggestionsDataNoTimeoutHelper(bool interleaved_requests) {
// Field trial enabled with a specific suggestions URL.
EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsSuffix,
- kFakeBlacklistSuffix);
+ kFakeBlacklistSuffix, false);
scoped_ptr<SuggestionsService> suggestions_service(
CreateSuggestionsServiceWithMockStore());
EXPECT_TRUE(suggestions_service != NULL);
@@ -223,10 +228,19 @@ TEST_F(SuggestionsServiceTest, ServiceBeingCreated) {
EXPECT_TRUE(CreateSuggestionsService() == NULL);
// Field trial enabled.
- EnableFieldTrial("", "", "");
+ EnableFieldTrial("", "", "", false);
EXPECT_TRUE(CreateSuggestionsService() != NULL);
}
+TEST_F(SuggestionsServiceTest, IsControlGroup) {
+ // Field trial enabled.
+ EnableFieldTrial("", "", "", false);
+ EXPECT_FALSE(SuggestionsService::IsControlGroup());
+
+ EnableFieldTrial("", "", "", true);
+ EXPECT_TRUE(SuggestionsService::IsControlGroup());
+}
+
TEST_F(SuggestionsServiceTest, FetchSuggestionsDataNoTimeout) {
FetchSuggestionsDataNoTimeoutHelper(false);
}
@@ -238,7 +252,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataNoTimeoutInterleaved) {
TEST_F(SuggestionsServiceTest, FetchSuggestionsDataRequestError) {
// Field trial enabled with a specific suggestions URL.
EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsSuffix,
- kFakeBlacklistSuffix);
+ kFakeBlacklistSuffix, false);
scoped_ptr<SuggestionsService> suggestions_service(
CreateSuggestionsServiceWithMockStore());
EXPECT_TRUE(suggestions_service != NULL);
@@ -268,7 +282,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataRequestError) {
TEST_F(SuggestionsServiceTest, FetchSuggestionsDataResponseNotOK) {
// Field trial enabled with a specific suggestions URL.
EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsSuffix,
- kFakeBlacklistSuffix);
+ kFakeBlacklistSuffix, false);
scoped_ptr<SuggestionsService> suggestions_service(
CreateSuggestionsServiceWithMockStore());
EXPECT_TRUE(suggestions_service != NULL);
@@ -297,7 +311,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataResponseNotOK) {
TEST_F(SuggestionsServiceTest, BlacklistURL) {
EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsSuffix,
- kFakeBlacklistSuffix);
+ kFakeBlacklistSuffix, false);
scoped_ptr<SuggestionsService> suggestions_service(
CreateSuggestionsServiceWithMockStore());
EXPECT_TRUE(suggestions_service != NULL);

Powered by Google App Engine
This is Rietveld 408576698