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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 EXPECT_EQ(std::string(kValueForSwitch2), | 244 EXPECT_EQ(std::string(kValueForSwitch2), |
245 command_line.GetSwitchValueASCII(kSwitch2)); | 245 command_line.GetSwitchValueASCII(kSwitch2)); |
246 | 246 |
247 // Confirm that there is no '=' in the command line for simple switches. | 247 // Confirm that there is no '=' in the command line for simple switches. |
248 std::string switch1_with_equals = std::string("--") + | 248 std::string switch1_with_equals = std::string("--") + |
249 std::string(kSwitch1) + | 249 std::string(kSwitch1) + |
250 std::string("="); | 250 std::string("="); |
251 #if defined(OS_WIN) | 251 #if defined(OS_WIN) |
252 EXPECT_EQ(std::wstring::npos, | 252 EXPECT_EQ(std::wstring::npos, |
253 command_line.GetCommandLineString().find( | 253 command_line.GetCommandLineString().find( |
254 ASCIIToWide(switch1_with_equals))); | 254 base::ASCIIToWide(switch1_with_equals))); |
255 #else | 255 #else |
256 EXPECT_EQ(std::string::npos, | 256 EXPECT_EQ(std::string::npos, |
257 command_line.GetCommandLineString().find(switch1_with_equals)); | 257 command_line.GetCommandLineString().find(switch1_with_equals)); |
258 #endif | 258 #endif |
259 | 259 |
260 // And confirm there is a '=' for switches with values. | 260 // And confirm there is a '=' for switches with values. |
261 std::string switch2_with_equals = std::string("--") + | 261 std::string switch2_with_equals = std::string("--") + |
262 std::string(kSwitch2) + | 262 std::string(kSwitch2) + |
263 std::string("="); | 263 std::string("="); |
264 #if defined(OS_WIN) | 264 #if defined(OS_WIN) |
265 EXPECT_NE(std::wstring::npos, | 265 EXPECT_NE(std::wstring::npos, |
266 command_line.GetCommandLineString().find( | 266 command_line.GetCommandLineString().find( |
267 ASCIIToWide(switch2_with_equals))); | 267 base::ASCIIToWide(switch2_with_equals))); |
268 #else | 268 #else |
269 EXPECT_NE(std::string::npos, | 269 EXPECT_NE(std::string::npos, |
270 command_line.GetCommandLineString().find(switch2_with_equals)); | 270 command_line.GetCommandLineString().find(switch2_with_equals)); |
271 #endif | 271 #endif |
272 | 272 |
273 // And it should persist | 273 // And it should persist |
274 scoped_ptr<ListValue> switch_prefs(GetFlagsExperimentsData(&prefs_)); | 274 scoped_ptr<ListValue> switch_prefs(GetFlagsExperimentsData(&prefs_)); |
275 ASSERT_TRUE(switch_prefs.get()); | 275 ASSERT_TRUE(switch_prefs.get()); |
276 EXPECT_EQ(arraysize(kExperiments), switch_prefs->GetSize()); | 276 EXPECT_EQ(arraysize(kExperiments), switch_prefs->GetSize()); |
277 } | 277 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 testing::SetExperiments(NULL, 0); | 317 testing::SetExperiments(NULL, 0); |
318 size_t count; | 318 size_t count; |
319 const Experiment* experiments = testing::GetExperiments(&count); | 319 const Experiment* experiments = testing::GetExperiments(&count); |
320 for (size_t i = 0; i < count; ++i) { | 320 for (size_t i = 0; i < count; ++i) { |
321 std::string name = experiments->internal_name; | 321 std::string name = experiments->internal_name; |
322 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; | 322 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 } // namespace about_flags | 326 } // namespace about_flags |
OLD | NEW |