blob: 4251cffcec57e5c6dead1f20961b5d0a279441f2 [file] [log] [blame]
[email protected]1bc78422011-03-31 08:41:381// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]e2ddbc92010-10-15 20:02:072// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]3853a4c2013-02-11 17:15:575#include "base/prefs/pref_registry_simple.h"
[email protected]e5ba874f2013-02-14 17:20:196#include "base/prefs/testing_pref_service.h"
[email protected]3ea1b182013-02-08 22:38:417#include "base/strings/string_number_conversions.h"
[email protected]135cb802013-06-09 16:44:208#include "base/strings/utf_string_conversions.h"
[email protected]a314ee5a2010-10-26 21:23:289#include "base/values.h"
[email protected]8a6ff28d2010-12-02 16:35:1910#include "chrome/browser/about_flags.h"
[email protected]e2ddbc92010-10-15 20:02:0711#include "chrome/common/chrome_switches.h"
12#include "chrome/common/pref_names.h"
[email protected]a314ee5a2010-10-26 21:23:2813#include "grit/chromium_strings.h"
[email protected]e2ddbc92010-10-15 20:02:0714#include "testing/gtest/include/gtest/gtest.h"
15
[email protected]a314ee5a2010-10-26 21:23:2816const char kFlags1[] = "flag1";
17const char kFlags2[] = "flag2";
18const char kFlags3[] = "flag3";
[email protected]8a6ff28d2010-12-02 16:35:1919const char kFlags4[] = "flag4";
[email protected]83e9fa702013-02-25 19:30:4420const char kFlags5[] = "flag5";
[email protected]e2ddbc92010-10-15 20:02:0721
[email protected]a314ee5a2010-10-26 21:23:2822const char kSwitch1[] = "switch";
23const char kSwitch2[] = "switch2";
24const char kSwitch3[] = "switch3";
[email protected]a82744532011-02-11 16:15:5325const char kValueForSwitch2[] = "value_for_switch2";
[email protected]e2ddbc92010-10-15 20:02:0726
[email protected]8a6ff28d2010-12-02 16:35:1927const char kMultiSwitch1[] = "multi_switch1";
28const char kMultiSwitch2[] = "multi_switch2";
[email protected]a82744532011-02-11 16:15:5329const char kValueForMultiSwitch2[] = "value_for_multi_switch2";
[email protected]8a6ff28d2010-12-02 16:35:1930
[email protected]83e9fa702013-02-25 19:30:4431const char kEnableDisableValue1[] = "value1";
32const char kEnableDisableValue2[] = "value2";
33
[email protected]e2ddbc92010-10-15 20:02:0734namespace about_flags {
35
[email protected]8a6ff28d2010-12-02 16:35:1936const Experiment::Choice kMultiChoices[] = {
[email protected]a82744532011-02-11 16:15:5337 { IDS_PRODUCT_NAME, "", "" },
38 { IDS_PRODUCT_NAME, kMultiSwitch1, "" },
39 { IDS_PRODUCT_NAME, kMultiSwitch2, kValueForMultiSwitch2 },
[email protected]8a6ff28d2010-12-02 16:35:1940};
41
42// The experiments that are set for these tests. The 3rd experiment is not
43// supported on the current platform, all others are.
[email protected]a314ee5a2010-10-26 21:23:2844static Experiment kExperiments[] = {
45 {
46 kFlags1,
47 IDS_PRODUCT_NAME,
48 IDS_PRODUCT_NAME,
49 0, // Ends up being mapped to the current platform.
[email protected]8a6ff28d2010-12-02 16:35:1950 Experiment::SINGLE_VALUE,
51 kSwitch1,
[email protected]a82744532011-02-11 16:15:5352 "",
[email protected]8a6ff28d2010-12-02 16:35:1953 NULL,
[email protected]83e9fa702013-02-25 19:30:4454 NULL,
55 NULL,
[email protected]8a6ff28d2010-12-02 16:35:1956 0
[email protected]a314ee5a2010-10-26 21:23:2857 },
58 {
59 kFlags2,
60 IDS_PRODUCT_NAME,
61 IDS_PRODUCT_NAME,
62 0, // Ends up being mapped to the current platform.
[email protected]8a6ff28d2010-12-02 16:35:1963 Experiment::SINGLE_VALUE,
64 kSwitch2,
[email protected]a82744532011-02-11 16:15:5365 kValueForSwitch2,
[email protected]8a6ff28d2010-12-02 16:35:1966 NULL,
[email protected]83e9fa702013-02-25 19:30:4467 NULL,
68 NULL,
[email protected]8a6ff28d2010-12-02 16:35:1969 0
[email protected]a314ee5a2010-10-26 21:23:2870 },
71 {
72 kFlags3,
73 IDS_PRODUCT_NAME,
74 IDS_PRODUCT_NAME,
75 0, // This ends up enabling for an OS other than the current.
[email protected]8a6ff28d2010-12-02 16:35:1976 Experiment::SINGLE_VALUE,
77 kSwitch3,
[email protected]a82744532011-02-11 16:15:5378 "",
[email protected]8a6ff28d2010-12-02 16:35:1979 NULL,
[email protected]83e9fa702013-02-25 19:30:4480 NULL,
81 NULL,
[email protected]8a6ff28d2010-12-02 16:35:1982 0
83 },
84 {
85 kFlags4,
86 IDS_PRODUCT_NAME,
87 IDS_PRODUCT_NAME,
88 0, // Ends up being mapped to the current platform.
89 Experiment::MULTI_VALUE,
90 "",
[email protected]a82744532011-02-11 16:15:5391 "",
[email protected]83e9fa702013-02-25 19:30:4492 "",
93 "",
[email protected]8a6ff28d2010-12-02 16:35:1994 kMultiChoices,
95 arraysize(kMultiChoices)
[email protected]a314ee5a2010-10-26 21:23:2896 },
[email protected]83e9fa702013-02-25 19:30:4497 {
98 kFlags5,
99 IDS_PRODUCT_NAME,
100 IDS_PRODUCT_NAME,
101 0, // Ends up being mapped to the current platform.
102 Experiment::ENABLE_DISABLE_VALUE,
103 kSwitch1,
104 kEnableDisableValue1,
105 kSwitch2,
106 kEnableDisableValue2,
107 NULL,
108 3
109 },
[email protected]a314ee5a2010-10-26 21:23:28110};
111
[email protected]e2ddbc92010-10-15 20:02:07112class AboutFlagsTest : public ::testing::Test {
113 protected:
114 AboutFlagsTest() {
[email protected]b1de2c72013-02-06 02:45:47115 prefs_.registry()->RegisterListPref(prefs::kEnabledLabsExperiments);
[email protected]e2ddbc92010-10-15 20:02:07116 testing::ClearState();
117 }
118
[email protected]83e9fa702013-02-25 19:30:44119 virtual void SetUp() OVERRIDE {
[email protected]a314ee5a2010-10-26 21:23:28120 for (size_t i = 0; i < arraysize(kExperiments); ++i)
121 kExperiments[i].supported_platforms = GetCurrentPlatform();
122
123 int os_other_than_current = 1;
124 while (os_other_than_current == GetCurrentPlatform())
125 os_other_than_current <<= 1;
126 kExperiments[2].supported_platforms = os_other_than_current;
127
128 testing::SetExperiments(kExperiments, arraysize(kExperiments));
129 }
130
[email protected]83e9fa702013-02-25 19:30:44131 virtual void TearDown() OVERRIDE {
[email protected]a314ee5a2010-10-26 21:23:28132 testing::SetExperiments(NULL, 0);
133 }
134
[email protected]5b199522012-12-22 17:24:44135 TestingPrefServiceSimple prefs_;
[email protected]e2ddbc92010-10-15 20:02:07136};
137
[email protected]147492b2013-03-19 23:52:08138
139TEST_F(AboutFlagsTest, NoChangeNoRestart) {
140 EXPECT_FALSE(IsRestartNeededToCommitChanges());
141 SetExperimentEnabled(&prefs_, kFlags1, false);
142 EXPECT_FALSE(IsRestartNeededToCommitChanges());
143}
144
[email protected]e2ddbc92010-10-15 20:02:07145TEST_F(AboutFlagsTest, ChangeNeedsRestart) {
[email protected]e2ddbc92010-10-15 20:02:07146 EXPECT_FALSE(IsRestartNeededToCommitChanges());
147 SetExperimentEnabled(&prefs_, kFlags1, true);
148 EXPECT_TRUE(IsRestartNeededToCommitChanges());
149}
150
[email protected]147492b2013-03-19 23:52:08151TEST_F(AboutFlagsTest, MultiFlagChangeNeedsRestart) {
152 const Experiment& experiment = kExperiments[3];
153 ASSERT_EQ(kFlags4, experiment.internal_name);
154 EXPECT_FALSE(IsRestartNeededToCommitChanges());
155 // Enable the 2nd choice of the multi-value.
156 SetExperimentEnabled(&prefs_, experiment.NameForChoice(2), true);
157 EXPECT_TRUE(IsRestartNeededToCommitChanges());
158 testing::ClearState();
159 EXPECT_FALSE(IsRestartNeededToCommitChanges());
160 // Enable the default choice now.
161 SetExperimentEnabled(&prefs_, experiment.NameForChoice(0), true);
162 EXPECT_TRUE(IsRestartNeededToCommitChanges());
163}
164
[email protected]e2ddbc92010-10-15 20:02:07165TEST_F(AboutFlagsTest, AddTwoFlagsRemoveOne) {
[email protected]e2ddbc92010-10-15 20:02:07166 // Add two experiments, check they're there.
167 SetExperimentEnabled(&prefs_, kFlags1, true);
168 SetExperimentEnabled(&prefs_, kFlags2, true);
169
[email protected]1bc78422011-03-31 08:41:38170 const ListValue* experiments_list = prefs_.GetList(
[email protected]e2ddbc92010-10-15 20:02:07171 prefs::kEnabledLabsExperiments);
172 ASSERT_TRUE(experiments_list != NULL);
173
174 ASSERT_EQ(2u, experiments_list->GetSize());
175
176 std::string s0;
177 ASSERT_TRUE(experiments_list->GetString(0, &s0));
178 std::string s1;
179 ASSERT_TRUE(experiments_list->GetString(1, &s1));
180
181 EXPECT_TRUE(s0 == kFlags1 || s1 == kFlags1);
182 EXPECT_TRUE(s0 == kFlags2 || s1 == kFlags2);
183
184 // Remove one experiment, check the other's still around.
185 SetExperimentEnabled(&prefs_, kFlags2, false);
186
[email protected]1bc78422011-03-31 08:41:38187 experiments_list = prefs_.GetList(prefs::kEnabledLabsExperiments);
[email protected]e2ddbc92010-10-15 20:02:07188 ASSERT_TRUE(experiments_list != NULL);
189 ASSERT_EQ(1u, experiments_list->GetSize());
190 ASSERT_TRUE(experiments_list->GetString(0, &s0));
191 EXPECT_TRUE(s0 == kFlags1);
192}
193
194TEST_F(AboutFlagsTest, AddTwoFlagsRemoveBoth) {
[email protected]e2ddbc92010-10-15 20:02:07195 // Add two experiments, check the pref exists.
196 SetExperimentEnabled(&prefs_, kFlags1, true);
197 SetExperimentEnabled(&prefs_, kFlags2, true);
[email protected]1bc78422011-03-31 08:41:38198 const ListValue* experiments_list = prefs_.GetList(
[email protected]e2ddbc92010-10-15 20:02:07199 prefs::kEnabledLabsExperiments);
200 ASSERT_TRUE(experiments_list != NULL);
201
202 // Remove both, the pref should have been removed completely.
203 SetExperimentEnabled(&prefs_, kFlags1, false);
204 SetExperimentEnabled(&prefs_, kFlags2, false);
[email protected]1bc78422011-03-31 08:41:38205 experiments_list = prefs_.GetList(prefs::kEnabledLabsExperiments);
[email protected]e2ddbc92010-10-15 20:02:07206 EXPECT_TRUE(experiments_list == NULL || experiments_list->GetSize() == 0);
207}
208
209TEST_F(AboutFlagsTest, ConvertFlagsToSwitches) {
[email protected]e2ddbc92010-10-15 20:02:07210 SetExperimentEnabled(&prefs_, kFlags1, true);
211
[email protected]947446b2010-10-21 03:36:31212 CommandLine command_line(CommandLine::NO_PROGRAM);
[email protected]e2ddbc92010-10-15 20:02:07213 command_line.AppendSwitch("foo");
214
215 EXPECT_TRUE(command_line.HasSwitch("foo"));
[email protected]a314ee5a2010-10-26 21:23:28216 EXPECT_FALSE(command_line.HasSwitch(kSwitch1));
[email protected]e2ddbc92010-10-15 20:02:07217
218 ConvertFlagsToSwitches(&prefs_, &command_line);
219
220 EXPECT_TRUE(command_line.HasSwitch("foo"));
[email protected]cd7fa99f2011-09-07 01:24:55221 EXPECT_TRUE(command_line.HasSwitch(kSwitch1));
[email protected]e2ddbc92010-10-15 20:02:07222}
223
224TEST_F(AboutFlagsTest, RemoveFlagSwitches) {
[email protected]e2ddbc92010-10-15 20:02:07225 std::map<std::string, CommandLine::StringType> switch_list;
[email protected]a314ee5a2010-10-26 21:23:28226 switch_list[kSwitch1] = CommandLine::StringType();
[email protected]e2ddbc92010-10-15 20:02:07227 switch_list[switches::kFlagSwitchesBegin] = CommandLine::StringType();
228 switch_list[switches::kFlagSwitchesEnd] = CommandLine::StringType();
229 switch_list["foo"] = CommandLine::StringType();
230
231 SetExperimentEnabled(&prefs_, kFlags1, true);
232
233 // This shouldn't do anything before ConvertFlagsToSwitches() wasn't called.
234 RemoveFlagsSwitches(&switch_list);
235 ASSERT_EQ(4u, switch_list.size());
[email protected]a314ee5a2010-10-26 21:23:28236 EXPECT_TRUE(switch_list.find(kSwitch1) != switch_list.end());
[email protected]e2ddbc92010-10-15 20:02:07237 EXPECT_TRUE(switch_list.find(switches::kFlagSwitchesBegin) !=
238 switch_list.end());
239 EXPECT_TRUE(switch_list.find(switches::kFlagSwitchesEnd) !=
240 switch_list.end());
241 EXPECT_TRUE(switch_list.find("foo") != switch_list.end());
242
243 // Call ConvertFlagsToSwitches(), then RemoveFlagsSwitches() again.
[email protected]947446b2010-10-21 03:36:31244 CommandLine command_line(CommandLine::NO_PROGRAM);
[email protected]e2ddbc92010-10-15 20:02:07245 command_line.AppendSwitch("foo");
246 ConvertFlagsToSwitches(&prefs_, &command_line);
247 RemoveFlagsSwitches(&switch_list);
248
249 // Now the about:flags-related switch should have been removed.
250 ASSERT_EQ(1u, switch_list.size());
251 EXPECT_TRUE(switch_list.find("foo") != switch_list.end());
252}
253
[email protected]a314ee5a2010-10-26 21:23:28254// Tests enabling experiments that aren't supported on the current platform.
255TEST_F(AboutFlagsTest, PersistAndPrune) {
[email protected]8a6ff28d2010-12-02 16:35:19256 // Enable experiments 1 and 3.
[email protected]a314ee5a2010-10-26 21:23:28257 SetExperimentEnabled(&prefs_, kFlags1, true);
258 SetExperimentEnabled(&prefs_, kFlags3, true);
259 CommandLine command_line(CommandLine::NO_PROGRAM);
260 EXPECT_FALSE(command_line.HasSwitch(kSwitch1));
261 EXPECT_FALSE(command_line.HasSwitch(kSwitch3));
262
263 // Convert the flags to switches. Experiment 3 shouldn't be among the switches
264 // as it is not applicable to the current platform.
265 ConvertFlagsToSwitches(&prefs_, &command_line);
[email protected]cd7fa99f2011-09-07 01:24:55266 EXPECT_TRUE(command_line.HasSwitch(kSwitch1));
[email protected]a314ee5a2010-10-26 21:23:28267 EXPECT_FALSE(command_line.HasSwitch(kSwitch3));
268
269 // Experiment 3 should show still be persisted in preferences though.
[email protected]ee28495a2013-05-20 04:10:52270 const ListValue* experiments_list =
271 prefs_.GetList(prefs::kEnabledLabsExperiments);
272 ASSERT_TRUE(experiments_list);
273 EXPECT_EQ(2U, experiments_list->GetSize());
274 std::string s0;
275 ASSERT_TRUE(experiments_list->GetString(0, &s0));
276 EXPECT_EQ(kFlags1, s0);
277 std::string s1;
278 ASSERT_TRUE(experiments_list->GetString(1, &s1));
279 EXPECT_EQ(kFlags3, s1);
[email protected]8a6ff28d2010-12-02 16:35:19280}
281
[email protected]a82744532011-02-11 16:15:53282// Tests that switches which should have values get them in the command
283// line.
284TEST_F(AboutFlagsTest, CheckValues) {
285 // Enable experiments 1 and 2.
286 SetExperimentEnabled(&prefs_, kFlags1, true);
287 SetExperimentEnabled(&prefs_, kFlags2, true);
288 CommandLine command_line(CommandLine::NO_PROGRAM);
289 EXPECT_FALSE(command_line.HasSwitch(kSwitch1));
290 EXPECT_FALSE(command_line.HasSwitch(kSwitch2));
291
292 // Convert the flags to switches.
293 ConvertFlagsToSwitches(&prefs_, &command_line);
[email protected]cd7fa99f2011-09-07 01:24:55294 EXPECT_TRUE(command_line.HasSwitch(kSwitch1));
[email protected]007b3f82013-04-09 08:46:45295 EXPECT_EQ(std::string(), command_line.GetSwitchValueASCII(kSwitch1));
[email protected]cd7fa99f2011-09-07 01:24:55296 EXPECT_TRUE(command_line.HasSwitch(kSwitch2));
297 EXPECT_EQ(std::string(kValueForSwitch2),
[email protected]a82744532011-02-11 16:15:53298 command_line.GetSwitchValueASCII(kSwitch2));
299
300 // Confirm that there is no '=' in the command line for simple switches.
301 std::string switch1_with_equals = std::string("--") +
302 std::string(kSwitch1) +
303 std::string("=");
304#if defined(OS_WIN)
305 EXPECT_EQ(std::wstring::npos,
[email protected]61a4c6f2011-07-20 04:54:52306 command_line.GetCommandLineString().find(
[email protected]47e870b2013-02-24 21:14:53307 ASCIIToWide(switch1_with_equals)));
[email protected]a82744532011-02-11 16:15:53308#else
309 EXPECT_EQ(std::string::npos,
[email protected]61a4c6f2011-07-20 04:54:52310 command_line.GetCommandLineString().find(switch1_with_equals));
[email protected]a82744532011-02-11 16:15:53311#endif
312
313 // And confirm there is a '=' for switches with values.
314 std::string switch2_with_equals = std::string("--") +
315 std::string(kSwitch2) +
316 std::string("=");
[email protected]5b199522012-12-22 17:24:44317#if defined(OS_WIN)
[email protected]cd7fa99f2011-09-07 01:24:55318 EXPECT_NE(std::wstring::npos,
[email protected]61a4c6f2011-07-20 04:54:52319 command_line.GetCommandLineString().find(
[email protected]47e870b2013-02-24 21:14:53320 ASCIIToWide(switch2_with_equals)));
[email protected]a82744532011-02-11 16:15:53321#else
[email protected]cd7fa99f2011-09-07 01:24:55322 EXPECT_NE(std::string::npos,
[email protected]61a4c6f2011-07-20 04:54:52323 command_line.GetCommandLineString().find(switch2_with_equals));
[email protected]a82744532011-02-11 16:15:53324#endif
325
[email protected]ee28495a2013-05-20 04:10:52326 // And it should persist.
327 const ListValue* experiments_list =
328 prefs_.GetList(prefs::kEnabledLabsExperiments);
329 ASSERT_TRUE(experiments_list);
330 EXPECT_EQ(2U, experiments_list->GetSize());
331 std::string s0;
332 ASSERT_TRUE(experiments_list->GetString(0, &s0));
333 EXPECT_EQ(kFlags1, s0);
334 std::string s1;
335 ASSERT_TRUE(experiments_list->GetString(1, &s1));
336 EXPECT_EQ(kFlags2, s1);
[email protected]a82744532011-02-11 16:15:53337}
338
[email protected]28e35af2011-02-09 12:56:22339// Tests multi-value type experiments.
[email protected]8a6ff28d2010-12-02 16:35:19340TEST_F(AboutFlagsTest, MultiValues) {
[email protected]83e9fa702013-02-25 19:30:44341 const Experiment& experiment = kExperiments[3];
342 ASSERT_EQ(kFlags4, experiment.internal_name);
343
[email protected]28e35af2011-02-09 12:56:22344 // Initially, the first "deactivated" option of the multi experiment should
345 // be set.
[email protected]8a6ff28d2010-12-02 16:35:19346 {
347 CommandLine command_line(CommandLine::NO_PROGRAM);
348 ConvertFlagsToSwitches(&prefs_, &command_line);
[email protected]28e35af2011-02-09 12:56:22349 EXPECT_FALSE(command_line.HasSwitch(kMultiSwitch1));
[email protected]8a6ff28d2010-12-02 16:35:19350 EXPECT_FALSE(command_line.HasSwitch(kMultiSwitch2));
351 }
352
[email protected]28e35af2011-02-09 12:56:22353 // Enable the 2nd choice of the multi-value.
[email protected]83e9fa702013-02-25 19:30:44354 SetExperimentEnabled(&prefs_, experiment.NameForChoice(2), true);
[email protected]8a6ff28d2010-12-02 16:35:19355 {
356 CommandLine command_line(CommandLine::NO_PROGRAM);
357 ConvertFlagsToSwitches(&prefs_, &command_line);
358 EXPECT_FALSE(command_line.HasSwitch(kMultiSwitch1));
[email protected]cd7fa99f2011-09-07 01:24:55359 EXPECT_TRUE(command_line.HasSwitch(kMultiSwitch2));
360 EXPECT_EQ(std::string(kValueForMultiSwitch2),
[email protected]a82744532011-02-11 16:15:53361 command_line.GetSwitchValueASCII(kMultiSwitch2));
[email protected]8a6ff28d2010-12-02 16:35:19362 }
363
364 // Disable the multi-value experiment.
[email protected]83e9fa702013-02-25 19:30:44365 SetExperimentEnabled(&prefs_, experiment.NameForChoice(0), true);
366 {
367 CommandLine command_line(CommandLine::NO_PROGRAM);
368 ConvertFlagsToSwitches(&prefs_, &command_line);
369 EXPECT_FALSE(command_line.HasSwitch(kMultiSwitch1));
370 EXPECT_FALSE(command_line.HasSwitch(kMultiSwitch2));
371 }
372}
373
374TEST_F(AboutFlagsTest, EnableDisableValues) {
375 const Experiment& experiment = kExperiments[4];
376 ASSERT_EQ(kFlags5, experiment.internal_name);
377
378 // Nothing selected.
379 {
380 CommandLine command_line(CommandLine::NO_PROGRAM);
381 ConvertFlagsToSwitches(&prefs_, &command_line);
382 EXPECT_FALSE(command_line.HasSwitch(kSwitch1));
383 EXPECT_FALSE(command_line.HasSwitch(kSwitch2));
384 }
385
386 // "Enable" option selected.
387 SetExperimentEnabled(&prefs_, experiment.NameForChoice(1), true);
388 {
389 CommandLine command_line(CommandLine::NO_PROGRAM);
390 ConvertFlagsToSwitches(&prefs_, &command_line);
391 EXPECT_TRUE(command_line.HasSwitch(kSwitch1));
392 EXPECT_FALSE(command_line.HasSwitch(kSwitch2));
393 EXPECT_EQ(kEnableDisableValue1, command_line.GetSwitchValueASCII(kSwitch1));
394 }
395
396 // "Disable" option selected.
397 SetExperimentEnabled(&prefs_, experiment.NameForChoice(2), true);
398 {
399 CommandLine command_line(CommandLine::NO_PROGRAM);
400 ConvertFlagsToSwitches(&prefs_, &command_line);
401 EXPECT_FALSE(command_line.HasSwitch(kSwitch1));
402 EXPECT_TRUE(command_line.HasSwitch(kSwitch2));
403 EXPECT_EQ(kEnableDisableValue2, command_line.GetSwitchValueASCII(kSwitch2));
404 }
405
406 // "Default" option selected, same as nothing selected.
407 SetExperimentEnabled(&prefs_, experiment.NameForChoice(0), true);
[email protected]8a6ff28d2010-12-02 16:35:19408 {
409 CommandLine command_line(CommandLine::NO_PROGRAM);
410 ConvertFlagsToSwitches(&prefs_, &command_line);
411 EXPECT_FALSE(command_line.HasSwitch(kMultiSwitch1));
412 EXPECT_FALSE(command_line.HasSwitch(kMultiSwitch2));
413 }
414}
415
416// Makes sure there are no separators in any of the experiment names.
417TEST_F(AboutFlagsTest, NoSeparators) {
418 testing::SetExperiments(NULL, 0);
419 size_t count;
420 const Experiment* experiments = testing::GetExperiments(&count);
421 for (size_t i = 0; i < count; ++i) {
422 std::string name = experiments->internal_name;
423 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i;
424 }
[email protected]a314ee5a2010-10-26 21:23:28425}
426
[email protected]e2ddbc92010-10-15 20:02:07427} // namespace about_flags