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

Side by Side Diff: chrome/common/variations/child_process_field_trial_syncer_unittest.cc

Issue 2504163005: Fix getting initially active trials with shared memory. (Closed)
Patch Set: Use typedefs Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/common/variations/child_process_field_trial_syncer.h" 5 #include "chrome/common/variations/child_process_field_trial_syncer.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 std::pair<std::string, std::string> MakeStringPair(const std::string& a, 47 std::pair<std::string, std::string> MakeStringPair(const std::string& a,
48 const std::string& b) { 48 const std::string& b) {
49 return std::make_pair(a, b); 49 return std::make_pair(a, b);
50 } 50 }
51 51
52 } // namespace 52 } // namespace
53 53
54 TEST(ChildProcessFieldTrialSyncerTest, FieldTrialState) { 54 TEST(ChildProcessFieldTrialSyncerTest, FieldTrialState) {
55 base::MessageLoop message_loop; 55 base::MessageLoop message_loop;
56 base::FieldTrialList field_trial_list(nullptr); 56 base::FieldTrialList field_trial_list(nullptr);
57 base::FieldTrialList::CreateTrialsFromCommandLine(
58 *base::CommandLine::ForCurrentProcess(), "field_trial_handle_switch");
57 59
58 base::FieldTrial* trial1 = base::FieldTrialList::CreateFieldTrial("A", "G1"); 60 base::FieldTrial* trial1 = base::FieldTrialList::CreateFieldTrial("A", "G1");
59 base::FieldTrial* trial2 = base::FieldTrialList::CreateFieldTrial("B", "G2"); 61 base::FieldTrial* trial2 = base::FieldTrialList::CreateFieldTrial("B", "G2");
60 base::FieldTrial* trial3 = base::FieldTrialList::CreateFieldTrial("C", "G3"); 62 base::FieldTrial* trial3 = base::FieldTrialList::CreateFieldTrial("C", "G3");
61 // Activate trial3 before command line is produced. 63 // Activate trial3 before command line is produced.
62 trial1->group(); 64 trial1->group();
63 65
64 std::string states_string; 66 std::string states_string;
65 base::FieldTrialList::AllStatesToString(&states_string); 67 base::FieldTrialList::AllStatesToString(&states_string);
66 68
(...skipping 18 matching lines...) Expand all
85 trial3->group(); 87 trial3->group();
86 // Notifications from field trial activation actually happen via posted tasks, 88 // Notifications from field trial activation actually happen via posted tasks,
87 // so invoke the run loop. 89 // so invoke the run loop.
88 base::RunLoop().RunUntilIdle(); 90 base::RunLoop().RunUntilIdle();
89 91
90 ASSERT_EQ(2U, observer.observed_entries_count()); 92 ASSERT_EQ(2U, observer.observed_entries_count());
91 EXPECT_EQ(MakeStringPair("C", "G3"), observer.get_observed_entry(1)); 93 EXPECT_EQ(MakeStringPair("C", "G3"), observer.get_observed_entry(1));
92 } 94 }
93 95
94 } // namespace chrome_variations 96 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « chrome/common/variations/child_process_field_trial_syncer.cc ('k') | content/public/test/render_view_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698