| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 EXPECT_EQ(std::string(kValueForSwitch2), | 337 EXPECT_EQ(std::string(kValueForSwitch2), |
| 338 command_line.GetSwitchValueASCII(kSwitch2)); | 338 command_line.GetSwitchValueASCII(kSwitch2)); |
| 339 | 339 |
| 340 // Confirm that there is no '=' in the command line for simple switches. | 340 // Confirm that there is no '=' in the command line for simple switches. |
| 341 std::string switch1_with_equals = std::string("--") + | 341 std::string switch1_with_equals = std::string("--") + |
| 342 std::string(kSwitch1) + | 342 std::string(kSwitch1) + |
| 343 std::string("="); | 343 std::string("="); |
| 344 #if defined(OS_WIN) | 344 #if defined(OS_WIN) |
| 345 EXPECT_EQ(std::wstring::npos, | 345 EXPECT_EQ(std::wstring::npos, |
| 346 command_line.GetCommandLineString().find( | 346 command_line.GetCommandLineString().find( |
| 347 ASCIIToWide(switch1_with_equals))); | 347 base::ASCIIToWide(switch1_with_equals))); |
| 348 #else | 348 #else |
| 349 EXPECT_EQ(std::string::npos, | 349 EXPECT_EQ(std::string::npos, |
| 350 command_line.GetCommandLineString().find(switch1_with_equals)); | 350 command_line.GetCommandLineString().find(switch1_with_equals)); |
| 351 #endif | 351 #endif |
| 352 | 352 |
| 353 // And confirm there is a '=' for switches with values. | 353 // And confirm there is a '=' for switches with values. |
| 354 std::string switch2_with_equals = std::string("--") + | 354 std::string switch2_with_equals = std::string("--") + |
| 355 std::string(kSwitch2) + | 355 std::string(kSwitch2) + |
| 356 std::string("="); | 356 std::string("="); |
| 357 #if defined(OS_WIN) | 357 #if defined(OS_WIN) |
| 358 EXPECT_NE(std::wstring::npos, | 358 EXPECT_NE(std::wstring::npos, |
| 359 command_line.GetCommandLineString().find( | 359 command_line.GetCommandLineString().find( |
| 360 ASCIIToWide(switch2_with_equals))); | 360 base::ASCIIToWide(switch2_with_equals))); |
| 361 #else | 361 #else |
| 362 EXPECT_NE(std::string::npos, | 362 EXPECT_NE(std::string::npos, |
| 363 command_line.GetCommandLineString().find(switch2_with_equals)); | 363 command_line.GetCommandLineString().find(switch2_with_equals)); |
| 364 #endif | 364 #endif |
| 365 | 365 |
| 366 // And it should persist. | 366 // And it should persist. |
| 367 const base::ListValue* experiments_list = | 367 const base::ListValue* experiments_list = |
| 368 prefs_.GetList(prefs::kEnabledLabsExperiments); | 368 prefs_.GetList(prefs::kEnabledLabsExperiments); |
| 369 ASSERT_TRUE(experiments_list); | 369 ASSERT_TRUE(experiments_list); |
| 370 EXPECT_EQ(2U, experiments_list->GetSize()); | 370 EXPECT_EQ(2U, experiments_list->GetSize()); |
| (...skipping 87 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 |