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

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

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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
10 #include <map> 9 #include <map>
10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/feature_list.h" 15 #include "base/feature_list.h"
16 #include "base/format_macros.h" 16 #include "base/format_macros.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 Study_Experiment* experiment = AddExperiment("A", 1, &study); 552 Study_Experiment* experiment = AddExperiment("A", 1, &study);
553 Study_Experiment_FeatureAssociation* association = 553 Study_Experiment_FeatureAssociation* association =
554 experiment->mutable_feature_association(); 554 experiment->mutable_feature_association();
555 if (test_case.enable_feature) 555 if (test_case.enable_feature)
556 association->add_enable_feature(test_case.enable_feature); 556 association->add_enable_feature(test_case.enable_feature);
557 else if (test_case.disable_feature) 557 else if (test_case.disable_feature)
558 association->add_disable_feature(test_case.disable_feature); 558 association->add_disable_feature(test_case.disable_feature);
559 559
560 EXPECT_TRUE( 560 EXPECT_TRUE(
561 CreateTrialFromStudyWithFeatureList(&study, feature_list.get())); 561 CreateTrialFromStudyWithFeatureList(&study, feature_list.get()));
562 base::FeatureList::SetInstance(feature_list.Pass()); 562 base::FeatureList::SetInstance(std::move(feature_list));
563 563
564 // |kUnrelatedFeature| should not be affected. 564 // |kUnrelatedFeature| should not be affected.
565 EXPECT_FALSE(base::FeatureList::IsEnabled(kUnrelatedFeature)); 565 EXPECT_FALSE(base::FeatureList::IsEnabled(kUnrelatedFeature));
566 566
567 // Before the associated feature is queried, the trial shouldn't be active. 567 // Before the associated feature is queried, the trial shouldn't be active.
568 EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name())); 568 EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name()));
569 569
570 EXPECT_EQ(test_case.expected_feature_off_state, 570 EXPECT_EQ(test_case.expected_feature_off_state,
571 base::FeatureList::IsEnabled(kFeatureOffByDefault)); 571 base::FeatureList::IsEnabled(kFeatureOffByDefault));
572 EXPECT_EQ(test_case.expected_feature_on_state, 572 EXPECT_EQ(test_case.expected_feature_on_state,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 689
690 AddExperiment(kForcedOnGroup, 0, &study) 690 AddExperiment(kForcedOnGroup, 0, &study)
691 ->mutable_feature_association() 691 ->mutable_feature_association()
692 ->set_forcing_feature_on(test_case.feature.name); 692 ->set_forcing_feature_on(test_case.feature.name);
693 AddExperiment(kForcedOffGroup, 0, &study) 693 AddExperiment(kForcedOffGroup, 0, &study)
694 ->mutable_feature_association() 694 ->mutable_feature_association()
695 ->set_forcing_feature_off(test_case.feature.name); 695 ->set_forcing_feature_off(test_case.feature.name);
696 696
697 EXPECT_TRUE( 697 EXPECT_TRUE(
698 CreateTrialFromStudyWithFeatureList(&study, feature_list.get())); 698 CreateTrialFromStudyWithFeatureList(&study, feature_list.get()));
699 base::FeatureList::SetInstance(feature_list.Pass()); 699 base::FeatureList::SetInstance(std::move(feature_list));
700 700
701 // Trial should not be activated initially, but later might get activated 701 // Trial should not be activated initially, but later might get activated
702 // depending on the expected values. 702 // depending on the expected values.
703 EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name())); 703 EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name()));
704 EXPECT_EQ(test_case.expected_feature_state, 704 EXPECT_EQ(test_case.expected_feature_state,
705 base::FeatureList::IsEnabled(test_case.feature)); 705 base::FeatureList::IsEnabled(test_case.feature));
706 EXPECT_EQ(test_case.expected_trial_activated, 706 EXPECT_EQ(test_case.expected_trial_activated,
707 base::FieldTrialList::IsTrialActive(study.name())); 707 base::FieldTrialList::IsTrialActive(study.name()));
708 } 708 }
709 } 709 }
710 710
711 } // namespace variations 711 } // namespace variations
OLDNEW
« no previous file with comments | « components/variations/service/variations_service_unittest.cc ('k') | components/version_ui/version_handler_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698