OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/variations/study_filtering.h" | 5 #include "components/variations/study_filtering.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 for (size_t i = 0; i <= arraysize(form_factors); ++i) { | 113 for (size_t i = 0; i <= arraysize(form_factors); ++i) { |
114 for (size_t j = 0; j < arraysize(form_factors); ++j) { | 114 for (size_t j = 0; j < arraysize(form_factors); ++j) { |
115 const bool expected = form_factor_added[j] || | 115 const bool expected = form_factor_added[j] || |
116 filter.form_factor_size() == 0; | 116 filter.form_factor_size() == 0; |
117 const bool result = internal::CheckStudyFormFactor(filter, | 117 const bool result = internal::CheckStudyFormFactor(filter, |
118 form_factors[j]); | 118 form_factors[j]); |
119 EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!"; | 119 EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!"; |
120 } | 120 } |
121 | 121 |
122 if (i < arraysize(form_factors)) { | 122 if (i < arraysize(form_factors)) { |
123 const int index = arraysize(form_factors) - i - 1;; | 123 const int index = arraysize(form_factors) - i - 1; |
124 filter.add_form_factor(form_factors[index]); | 124 filter.add_form_factor(form_factors[index]); |
125 form_factor_added[index] = true; | 125 form_factor_added[index] = true; |
126 } | 126 } |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 TEST(VariationsStudyFilteringTest, CheckStudyLocale) { | 130 TEST(VariationsStudyFilteringTest, CheckStudyLocale) { |
131 struct { | 131 struct { |
132 const char* filter_locales; | 132 const char* filter_locales; |
133 bool en_us_result; | 133 bool en_us_result; |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 573 |
574 default_group->set_name("def"); | 574 default_group->set_name("def"); |
575 EXPECT_TRUE(processed_study.Init(&study, false)); | 575 EXPECT_TRUE(processed_study.Init(&study, false)); |
576 Study_Experiment* repeated_group = study.add_experiment(); | 576 Study_Experiment* repeated_group = study.add_experiment(); |
577 repeated_group->set_name("abc"); | 577 repeated_group->set_name("abc"); |
578 repeated_group->set_probability_weight(1); | 578 repeated_group->set_probability_weight(1); |
579 EXPECT_FALSE(processed_study.Init(&study, false)); | 579 EXPECT_FALSE(processed_study.Init(&study, false)); |
580 } | 580 } |
581 | 581 |
582 } // namespace variations | 582 } // namespace variations |
OLD | NEW |