OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/prefs/pref_registry_simple.h" | 5 #include "base/prefs/pref_registry_simple.h" |
6 #include "base/prefs/testing_pref_service.h" | 6 #include "base/prefs/testing_pref_service.h" |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/about_flags.h" | 10 #include "chrome/browser/about_flags.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 TEST_F(AboutFlagsTest, CompareSwitchesToCurrentCommandLine) { | 236 TEST_F(AboutFlagsTest, CompareSwitchesToCurrentCommandLine) { |
237 SetExperimentEnabled(&flags_storage_, kFlags1, true); | 237 SetExperimentEnabled(&flags_storage_, kFlags1, true); |
238 | 238 |
239 CommandLine command_line(CommandLine::NO_PROGRAM); | 239 CommandLine command_line(CommandLine::NO_PROGRAM); |
240 command_line.AppendSwitch("foo"); | 240 command_line.AppendSwitch("foo"); |
241 | 241 |
242 CommandLine new_command_line(CommandLine::NO_PROGRAM); | 242 CommandLine new_command_line(CommandLine::NO_PROGRAM); |
243 ConvertFlagsToSwitches(&flags_storage_, &new_command_line, kAddSentinels); | 243 ConvertFlagsToSwitches(&flags_storage_, &new_command_line, kAddSentinels); |
244 | 244 |
245 EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine(new_command_line, | 245 EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine( |
246 command_line)); | 246 new_command_line, command_line, NULL)); |
247 | 247 |
248 ConvertFlagsToSwitches(&flags_storage_, &command_line, kAddSentinels); | 248 ConvertFlagsToSwitches(&flags_storage_, &command_line, kAddSentinels); |
249 | 249 |
250 EXPECT_TRUE(AreSwitchesIdenticalToCurrentCommandLine(new_command_line, | 250 EXPECT_TRUE(AreSwitchesIdenticalToCurrentCommandLine( |
251 command_line)); | 251 new_command_line, command_line, NULL)); |
252 | 252 |
253 // Now both have flags but different. | 253 // Now both have flags but different. |
254 SetExperimentEnabled(&flags_storage_, kFlags1, false); | 254 SetExperimentEnabled(&flags_storage_, kFlags1, false); |
255 SetExperimentEnabled(&flags_storage_, kFlags2, true); | 255 SetExperimentEnabled(&flags_storage_, kFlags2, true); |
256 | 256 |
257 CommandLine another_command_line(CommandLine::NO_PROGRAM); | 257 CommandLine another_command_line(CommandLine::NO_PROGRAM); |
258 ConvertFlagsToSwitches(&flags_storage_, &another_command_line, kAddSentinels); | 258 ConvertFlagsToSwitches(&flags_storage_, &another_command_line, kAddSentinels); |
259 | 259 |
260 EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine(new_command_line, | 260 EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine( |
261 another_command_line)); | 261 new_command_line, another_command_line, NULL)); |
262 } | 262 } |
263 | 263 |
264 TEST_F(AboutFlagsTest, RemoveFlagSwitches) { | 264 TEST_F(AboutFlagsTest, RemoveFlagSwitches) { |
265 std::map<std::string, CommandLine::StringType> switch_list; | 265 std::map<std::string, CommandLine::StringType> switch_list; |
266 switch_list[kSwitch1] = CommandLine::StringType(); | 266 switch_list[kSwitch1] = CommandLine::StringType(); |
267 switch_list[switches::kFlagSwitchesBegin] = CommandLine::StringType(); | 267 switch_list[switches::kFlagSwitchesBegin] = CommandLine::StringType(); |
268 switch_list[switches::kFlagSwitchesEnd] = CommandLine::StringType(); | 268 switch_list[switches::kFlagSwitchesEnd] = CommandLine::StringType(); |
269 switch_list["foo"] = CommandLine::StringType(); | 269 switch_list["foo"] = CommandLine::StringType(); |
270 | 270 |
271 SetExperimentEnabled(&flags_storage_, kFlags1, true); | 271 SetExperimentEnabled(&flags_storage_, kFlags1, true); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 testing::SetExperiments(NULL, 0); | 458 testing::SetExperiments(NULL, 0); |
459 size_t count; | 459 size_t count; |
460 const Experiment* experiments = testing::GetExperiments(&count); | 460 const Experiment* experiments = testing::GetExperiments(&count); |
461 for (size_t i = 0; i < count; ++i) { | 461 for (size_t i = 0; i < count; ++i) { |
462 std::string name = experiments->internal_name; | 462 std::string name = experiments->internal_name; |
463 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; | 463 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
467 } // namespace about_flags | 467 } // namespace about_flags |
OLD | NEW |