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

Side by Side Diff: components/variations/variations_seed_processor_unittest.cc

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/variations_seed_processor.h" 5 #include "components/variations/variations_seed_processor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9
9 #include <map> 10 #include <map>
11 #include <memory>
10 #include <utility> 12 #include <utility>
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/bind.h" 15 #include "base/bind.h"
14 #include "base/command_line.h" 16 #include "base/command_line.h"
15 #include "base/feature_list.h" 17 #include "base/feature_list.h"
16 #include "base/format_macros.h" 18 #include "base/format_macros.h"
17 #include "base/macros.h" 19 #include "base/macros.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
20 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
21 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
22 #include "components/variations/processed_study.h" 23 #include "components/variations/processed_study.h"
23 #include "components/variations/variations_associated_data.h" 24 #include "components/variations/variations_associated_data.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 namespace variations { 27 namespace variations {
27 28
28 namespace { 29 namespace {
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 {nullptr, kFeatureOnByDefault.name, false, false}, 580 {nullptr, kFeatureOnByDefault.name, false, false},
580 {nullptr, kFeatureOffByDefault.name, false, true}, 581 {nullptr, kFeatureOffByDefault.name, false, true},
581 }; 582 };
582 583
583 for (size_t i = 0; i < arraysize(test_cases); i++) { 584 for (size_t i = 0; i < arraysize(test_cases); i++) {
584 const auto& test_case = test_cases[i]; 585 const auto& test_case = test_cases[i];
585 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]", i)); 586 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]", i));
586 587
587 base::FieldTrialList field_trial_list(NULL); 588 base::FieldTrialList field_trial_list(NULL);
588 base::FeatureList::ClearInstanceForTesting(); 589 base::FeatureList::ClearInstanceForTesting();
589 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); 590 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
590 591
591 Study study; 592 Study study;
592 study.set_name("Study1"); 593 study.set_name("Study1");
593 study.set_default_experiment_name("B"); 594 study.set_default_experiment_name("B");
594 AddExperiment("B", 0, &study); 595 AddExperiment("B", 0, &study);
595 596
596 Study_Experiment* experiment = AddExperiment("A", 1, &study); 597 Study_Experiment* experiment = AddExperiment("A", 1, &study);
597 Study_Experiment_FeatureAssociation* association = 598 Study_Experiment_FeatureAssociation* association =
598 experiment->mutable_feature_association(); 599 experiment->mutable_feature_association();
599 if (test_case.enable_feature) 600 if (test_case.enable_feature)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 for (size_t i = 0; i < arraysize(test_cases); i++) { 704 for (size_t i = 0; i < arraysize(test_cases); i++) {
704 const auto& test_case = test_cases[i]; 705 const auto& test_case = test_cases[i];
705 const int group = test_case.one_hundred_percent_group; 706 const int group = test_case.one_hundred_percent_group;
706 SCOPED_TRACE(base::StringPrintf( 707 SCOPED_TRACE(base::StringPrintf(
707 "Test[%" PRIuS "]: %s [%s] [%s] %d", i, test_case.feature.name, 708 "Test[%" PRIuS "]: %s [%s] [%s] %d", i, test_case.feature.name,
708 test_case.enable_features_command_line, 709 test_case.enable_features_command_line,
709 test_case.disable_features_command_line, static_cast<int>(group))); 710 test_case.disable_features_command_line, static_cast<int>(group)));
710 711
711 base::FieldTrialList field_trial_list(NULL); 712 base::FieldTrialList field_trial_list(NULL);
712 base::FeatureList::ClearInstanceForTesting(); 713 base::FeatureList::ClearInstanceForTesting();
713 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); 714 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
714 feature_list->InitializeFromCommandLine( 715 feature_list->InitializeFromCommandLine(
715 test_case.enable_features_command_line, 716 test_case.enable_features_command_line,
716 test_case.disable_features_command_line); 717 test_case.disable_features_command_line);
717 718
718 Study study; 719 Study study;
719 study.set_name("Study1"); 720 study.set_name("Study1");
720 study.set_default_experiment_name("Default"); 721 study.set_default_experiment_name("Default");
721 AddExperiment(kDefaultGroup, group == DEFAULT_GROUP ? 1 : 0, &study); 722 AddExperiment(kDefaultGroup, group == DEFAULT_GROUP ? 1 : 0, &study);
722 723
723 Study_Experiment* feature_enable = 724 Study_Experiment* feature_enable =
(...skipping 21 matching lines...) Expand all
745 // depending on the expected values. 746 // depending on the expected values.
746 EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name())); 747 EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name()));
747 EXPECT_EQ(test_case.expected_feature_state, 748 EXPECT_EQ(test_case.expected_feature_state,
748 base::FeatureList::IsEnabled(test_case.feature)); 749 base::FeatureList::IsEnabled(test_case.feature));
749 EXPECT_EQ(test_case.expected_trial_activated, 750 EXPECT_EQ(test_case.expected_trial_activated,
750 base::FieldTrialList::IsTrialActive(study.name())); 751 base::FieldTrialList::IsTrialActive(study.name()));
751 } 752 }
752 } 753 }
753 754
754 } // namespace variations 755 } // namespace variations
OLDNEW
« no previous file with comments | « components/variations/service/variations_service_unittest.cc ('k') | components/version_ui/version_handler_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698