| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 internal::CheckStudyLocale(filter, "en-US")); | 205 internal::CheckStudyLocale(filter, "en-US")); |
| 206 EXPECT_EQ(test_cases[i].en_ca_result, | 206 EXPECT_EQ(test_cases[i].en_ca_result, |
| 207 internal::CheckStudyLocale(filter, "en-CA")); | 207 internal::CheckStudyLocale(filter, "en-CA")); |
| 208 EXPECT_EQ(test_cases[i].fr_result, | 208 EXPECT_EQ(test_cases[i].fr_result, |
| 209 internal::CheckStudyLocale(filter, "fr")); | 209 internal::CheckStudyLocale(filter, "fr")); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 TEST(VariationsStudyFilteringTest, CheckStudyPlatform) { | 213 TEST(VariationsStudyFilteringTest, CheckStudyPlatform) { |
| 214 const Study::Platform platforms[] = { | 214 const Study::Platform platforms[] = { |
| 215 Study::PLATFORM_WINDOWS, Study::PLATFORM_MAC, Study::PLATFORM_LINUX, | 215 Study::PLATFORM_WINDOWS, Study::PLATFORM_MAC, |
| 216 Study::PLATFORM_CHROMEOS, Study::PLATFORM_ANDROID, Study::PLATFORM_IOS, | 216 Study::PLATFORM_LINUX, Study::PLATFORM_CHROMEOS, |
| 217 Study::PLATFORM_ANDROID, Study::PLATFORM_IOS, |
| 218 Study::PLATFORM_ANDROID_WEBVIEW, |
| 217 }; | 219 }; |
| 218 ASSERT_EQ(Study::Platform_ARRAYSIZE, static_cast<int>(arraysize(platforms))); | 220 ASSERT_EQ(Study::Platform_ARRAYSIZE, static_cast<int>(arraysize(platforms))); |
| 219 bool platform_added[arraysize(platforms)] = { 0 }; | 221 bool platform_added[arraysize(platforms)] = { 0 }; |
| 220 | 222 |
| 221 Study::Filter filter; | 223 Study::Filter filter; |
| 222 | 224 |
| 223 // Check in the forwarded order. The loop cond is <= arraysize(platforms) | 225 // Check in the forwarded order. The loop cond is <= arraysize(platforms) |
| 224 // instead of < so that the result of adding the last channel gets checked. | 226 // instead of < so that the result of adding the last channel gets checked. |
| 225 for (size_t i = 0; i <= arraysize(platforms); ++i) { | 227 for (size_t i = 0; i <= arraysize(platforms); ++i) { |
| 226 for (size_t j = 0; j < arraysize(platforms); ++j) { | 228 for (size_t j = 0; j < arraysize(platforms); ++j) { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 680 |
| 679 default_group->set_name("def"); | 681 default_group->set_name("def"); |
| 680 EXPECT_TRUE(processed_study.Init(&study, false)); | 682 EXPECT_TRUE(processed_study.Init(&study, false)); |
| 681 Study::Experiment* repeated_group = study.add_experiment(); | 683 Study::Experiment* repeated_group = study.add_experiment(); |
| 682 repeated_group->set_name("abc"); | 684 repeated_group->set_name("abc"); |
| 683 repeated_group->set_probability_weight(1); | 685 repeated_group->set_probability_weight(1); |
| 684 EXPECT_FALSE(processed_study.Init(&study, false)); | 686 EXPECT_FALSE(processed_study.Init(&study, false)); |
| 685 } | 687 } |
| 686 | 688 |
| 687 } // namespace variations | 689 } // namespace variations |
| OLD | NEW |