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/utf_string_conversions.h" | 8 #include "base/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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Enable experiments 1 and 2. | 278 // Enable experiments 1 and 2. |
279 SetExperimentEnabled(&prefs_, kFlags1, true); | 279 SetExperimentEnabled(&prefs_, kFlags1, true); |
280 SetExperimentEnabled(&prefs_, kFlags2, true); | 280 SetExperimentEnabled(&prefs_, kFlags2, true); |
281 CommandLine command_line(CommandLine::NO_PROGRAM); | 281 CommandLine command_line(CommandLine::NO_PROGRAM); |
282 EXPECT_FALSE(command_line.HasSwitch(kSwitch1)); | 282 EXPECT_FALSE(command_line.HasSwitch(kSwitch1)); |
283 EXPECT_FALSE(command_line.HasSwitch(kSwitch2)); | 283 EXPECT_FALSE(command_line.HasSwitch(kSwitch2)); |
284 | 284 |
285 // Convert the flags to switches. | 285 // Convert the flags to switches. |
286 ConvertFlagsToSwitches(&prefs_, &command_line); | 286 ConvertFlagsToSwitches(&prefs_, &command_line); |
287 EXPECT_TRUE(command_line.HasSwitch(kSwitch1)); | 287 EXPECT_TRUE(command_line.HasSwitch(kSwitch1)); |
288 EXPECT_EQ(std::string(""), command_line.GetSwitchValueASCII(kSwitch1)); | 288 EXPECT_EQ(std::string(), command_line.GetSwitchValueASCII(kSwitch1)); |
289 EXPECT_TRUE(command_line.HasSwitch(kSwitch2)); | 289 EXPECT_TRUE(command_line.HasSwitch(kSwitch2)); |
290 EXPECT_EQ(std::string(kValueForSwitch2), | 290 EXPECT_EQ(std::string(kValueForSwitch2), |
291 command_line.GetSwitchValueASCII(kSwitch2)); | 291 command_line.GetSwitchValueASCII(kSwitch2)); |
292 | 292 |
293 // Confirm that there is no '=' in the command line for simple switches. | 293 // Confirm that there is no '=' in the command line for simple switches. |
294 std::string switch1_with_equals = std::string("--") + | 294 std::string switch1_with_equals = std::string("--") + |
295 std::string(kSwitch1) + | 295 std::string(kSwitch1) + |
296 std::string("="); | 296 std::string("="); |
297 #if defined(OS_WIN) | 297 #if defined(OS_WIN) |
298 EXPECT_EQ(std::wstring::npos, | 298 EXPECT_EQ(std::wstring::npos, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 testing::SetExperiments(NULL, 0); | 404 testing::SetExperiments(NULL, 0); |
405 size_t count; | 405 size_t count; |
406 const Experiment* experiments = testing::GetExperiments(&count); | 406 const Experiment* experiments = testing::GetExperiments(&count); |
407 for (size_t i = 0; i < count; ++i) { | 407 for (size_t i = 0; i < count; ++i) { |
408 std::string name = experiments->internal_name; | 408 std::string name = experiments->internal_name; |
409 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; | 409 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 } // namespace about_flags | 413 } // namespace about_flags |
OLD | NEW |