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/installer/util/experiment_storage_unittest.cc

Issue 2933043002: Installer support for Windows 10 inactive user toast. (Closed)
Patch Set: two studies Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/installer/util/experiment_storage.h" 5 #include "chrome/installer/util/experiment_storage.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/test_reg_util_win.h" 9 #include "base/test/test_reg_util_win.h"
10 #include "chrome/install_static/install_details.h" 10 #include "chrome/install_static/install_details.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 base::string16 encoded_metrics(ExperimentStorage::EncodeMetrics(metrics)); 114 base::string16 encoded_metrics(ExperimentStorage::EncodeMetrics(metrics));
115 EXPECT_EQ(L"AAAAAAAA", encoded_metrics); 115 EXPECT_EQ(L"AAAAAAAA", encoded_metrics);
116 ExperimentMetrics decoded_metrics; 116 ExperimentMetrics decoded_metrics;
117 ASSERT_TRUE( 117 ASSERT_TRUE(
118 ExperimentStorage::DecodeMetrics(encoded_metrics, &decoded_metrics)); 118 ExperimentStorage::DecodeMetrics(encoded_metrics, &decoded_metrics));
119 EXPECT_EQ(metrics, decoded_metrics); 119 EXPECT_EQ(metrics, decoded_metrics);
120 } 120 }
121 121
122 TEST_P(ExperimentStorageTest, TestReadWriteParticipation) { 122 TEST_P(ExperimentStorageTest, TestReadWriteParticipation) {
123 ExperimentStorage storage; 123 ExperimentStorage storage;
124 ExperimentStorage::Participation expected = 124 ExperimentStorage::Study expected = ExperimentStorage::kStudyOne;
125 ExperimentStorage::Participation::kIsParticipating;
126 ASSERT_TRUE(storage.AcquireLock()->WriteParticipation(expected)); 125 ASSERT_TRUE(storage.AcquireLock()->WriteParticipation(expected));
127 ExperimentStorage::Participation p; 126 ExperimentStorage::Study p;
128 ASSERT_TRUE(storage.AcquireLock()->ReadParticipation(&p)); 127 ASSERT_TRUE(storage.AcquireLock()->ReadParticipation(&p));
129 EXPECT_EQ(expected, p); 128 EXPECT_EQ(expected, p);
130 } 129 }
131 130
132 TEST_P(ExperimentStorageTest, TestLoadStoreExperiment) { 131 TEST_P(ExperimentStorageTest, TestLoadStoreExperiment) {
133 Experiment experiment; 132 Experiment experiment;
134 experiment.AssignGroup(5); 133 experiment.AssignGroup(5);
135 ExperimentStorage storage; 134 ExperimentStorage storage;
136 ASSERT_TRUE(storage.AcquireLock()->StoreExperiment(experiment)); 135 ASSERT_TRUE(storage.AcquireLock()->StoreExperiment(experiment));
137 Experiment stored_experiment; 136 Experiment stored_experiment;
(...skipping 22 matching lines...) Expand all
160 159
161 INSTANTIATE_TEST_CASE_P(UserLevel, 160 INSTANTIATE_TEST_CASE_P(UserLevel,
162 ExperimentStorageTest, 161 ExperimentStorageTest,
163 ::testing::Values(false)); 162 ::testing::Values(false));
164 163
165 INSTANTIATE_TEST_CASE_P(SystemLevel, 164 INSTANTIATE_TEST_CASE_P(SystemLevel,
166 ExperimentStorageTest, 165 ExperimentStorageTest,
167 ::testing::Values(true)); 166 ::testing::Values(true));
168 167
169 } // namespace installer 168 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698