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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "components/variations/processed_study.h" | 10 #include "components/variations/processed_study.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace chrome_variations { | 13 namespace variations { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Converts |time| to Study proto format. | 17 // Converts |time| to Study proto format. |
18 int64 TimeToProtoTime(const base::Time& time) { | 18 int64 TimeToProtoTime(const base::Time& time) { |
19 return (time - base::Time::UnixEpoch()).InSeconds(); | 19 return (time - base::Time::UnixEpoch()).InSeconds(); |
20 } | 20 } |
21 | 21 |
22 // Adds an experiment to |study| with the specified |name| and |probability|. | 22 // Adds an experiment to |study| with the specified |name| and |probability|. |
23 Study_Experiment* AddExperiment(const std::string& name, int probability, | 23 Study_Experiment* AddExperiment(const std::string& name, int probability, |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 EXPECT_FALSE(processed_study.Init(&study, false)); | 469 EXPECT_FALSE(processed_study.Init(&study, false)); |
470 | 470 |
471 default_group->set_name("def"); | 471 default_group->set_name("def"); |
472 EXPECT_TRUE(processed_study.Init(&study, false)); | 472 EXPECT_TRUE(processed_study.Init(&study, false)); |
473 Study_Experiment* repeated_group = study.add_experiment(); | 473 Study_Experiment* repeated_group = study.add_experiment(); |
474 repeated_group->set_name("abc"); | 474 repeated_group->set_name("abc"); |
475 repeated_group->set_probability_weight(1); | 475 repeated_group->set_probability_weight(1); |
476 EXPECT_FALSE(processed_study.Init(&study, false)); | 476 EXPECT_FALSE(processed_study.Init(&study, false)); |
477 } | 477 } |
478 | 478 |
479 } // namespace chrome_variations | 479 } // namespace variations |
OLD | NEW |