OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Unit tests for master preferences related methods. | 5 // Unit tests for master preferences related methods. |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 << expected_bool2[i].name; | 296 << expected_bool2[i].name; |
297 } | 297 } |
298 | 298 |
299 EXPECT_FALSE(prefs2.GetBool( | 299 EXPECT_FALSE(prefs2.GetBool( |
300 installer_util::master_preferences::kSystemLevel, &value)); | 300 installer_util::master_preferences::kSystemLevel, &value)); |
301 EXPECT_FALSE(prefs2.GetBool( | 301 EXPECT_FALSE(prefs2.GetBool( |
302 installer_util::master_preferences::kVerboseLogging, &value)); | 302 installer_util::master_preferences::kVerboseLogging, &value)); |
303 } | 303 } |
304 | 304 |
305 TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { | 305 TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { |
306 const std::wstring kChromeInstall(L"setup.exe"); | 306 std::wstringstream chrome_cmd, cf_cmd, ceee_cmd; |
307 const std::wstring kCfInstall(StringPrintf(L"setup.exe --%ls", | 307 chrome_cmd << "setup.exe"; |
308 installer_util::switches::kChromeFrame)); | 308 cf_cmd << "setup.exe --" << installer_util::switches::kChromeFrame; |
309 const std::wstring kCeeeInstall(StringPrintf(L"setup.exe --%ls", | 309 ceee_cmd << "setup.exe --" << installer_util::switches::kCeee; |
310 installer_util::switches::kCeee)); | |
311 | 310 |
312 CommandLine chrome_install(CommandLine::FromString(kChromeInstall)); | 311 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); |
313 CommandLine cf_install(CommandLine::FromString(kCfInstall)); | 312 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); |
314 CommandLine ceee_install(CommandLine::FromString(kCeeeInstall)); | 313 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); |
315 | 314 |
316 installer_util::MasterPreferences pref_chrome(chrome_install); | 315 installer_util::MasterPreferences pref_chrome(chrome_install); |
317 installer_util::MasterPreferences pref_cf(cf_install); | 316 installer_util::MasterPreferences pref_cf(cf_install); |
318 installer_util::MasterPreferences pref_ceee(ceee_install); | 317 installer_util::MasterPreferences pref_ceee(ceee_install); |
319 | 318 |
320 EXPECT_FALSE(pref_chrome.is_multi_install()); | 319 EXPECT_FALSE(pref_chrome.is_multi_install()); |
321 EXPECT_TRUE(pref_chrome.install_chrome()); | 320 EXPECT_TRUE(pref_chrome.install_chrome()); |
322 EXPECT_FALSE(pref_chrome.install_ceee()); | 321 EXPECT_FALSE(pref_chrome.install_ceee()); |
323 EXPECT_FALSE(pref_chrome.install_chrome_frame()); | 322 EXPECT_FALSE(pref_chrome.install_chrome_frame()); |
324 | 323 |
325 EXPECT_FALSE(pref_cf.is_multi_install()); | 324 EXPECT_FALSE(pref_cf.is_multi_install()); |
326 EXPECT_FALSE(pref_cf.install_chrome()); | 325 EXPECT_FALSE(pref_cf.install_chrome()); |
327 EXPECT_FALSE(pref_cf.install_ceee()); | 326 EXPECT_FALSE(pref_cf.install_ceee()); |
328 EXPECT_TRUE(pref_cf.install_chrome_frame()); | 327 EXPECT_TRUE(pref_cf.install_chrome_frame()); |
329 | 328 |
330 EXPECT_FALSE(pref_ceee.is_multi_install()); | 329 EXPECT_FALSE(pref_ceee.is_multi_install()); |
331 EXPECT_FALSE(pref_ceee.install_chrome()); | 330 EXPECT_FALSE(pref_ceee.install_chrome()); |
332 EXPECT_TRUE(pref_ceee.install_ceee()); | 331 EXPECT_TRUE(pref_ceee.install_ceee()); |
333 EXPECT_TRUE(pref_ceee.install_chrome_frame()); | 332 EXPECT_TRUE(pref_ceee.install_chrome_frame()); |
334 } | 333 } |
335 | 334 |
336 TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { | 335 TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { |
337 const std::wstring kChromeInstall(StringPrintf(L"setup.exe --%ls --%ls", | 336 using installer_util::switches::kMultiInstall; |
338 installer_util::switches::kMultiInstall, | 337 using installer_util::switches::kChrome; |
339 installer_util::switches::kChrome)); | 338 using installer_util::switches::kChromeFrame; |
340 const std::wstring kCfInstall(StringPrintf(L"setup.exe --%ls --%ls", | 339 using installer_util::switches::kCeee; |
341 installer_util::switches::kMultiInstall, | |
342 installer_util::switches::kChromeFrame)); | |
343 const std::wstring kCeeeInstall(StringPrintf(L"setup.exe --%ls --%ls", | |
344 installer_util::switches::kMultiInstall, | |
345 installer_util::switches::kCeee)); | |
346 const std::wstring kChromeCfInstall( | |
347 StringPrintf(L"setup.exe --%ls --%ls --%ls", | |
348 installer_util::switches::kMultiInstall, | |
349 installer_util::switches::kChrome, | |
350 installer_util::switches::kChromeFrame)); | |
351 const std::wstring kChromeCeeeCfInstall( | |
352 StringPrintf(L"setup.exe --%ls --%ls --%ls --%ls", | |
353 installer_util::switches::kMultiInstall, | |
354 installer_util::switches::kChrome, | |
355 installer_util::switches::kChromeFrame, | |
356 installer_util::switches::kCeee)); | |
357 | 340 |
358 CommandLine chrome_install(CommandLine::FromString(kChromeInstall)); | 341 std::wstringstream chrome_cmd, cf_cmd, ceee_cmd, chrome_cf_cmd, |
359 CommandLine cf_install(CommandLine::FromString(kCfInstall)); | 342 chrome_ceee_cf_cmd; |
360 CommandLine ceee_install(CommandLine::FromString(kCeeeInstall)); | 343 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; |
361 CommandLine chrome_cf_install(CommandLine::FromString(kChromeCfInstall)); | 344 cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChromeFrame; |
| 345 ceee_cmd << "setup.exe --" << kMultiInstall << " --" << kCeee; |
| 346 chrome_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << |
| 347 " --" << kChromeFrame; |
| 348 chrome_ceee_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << |
| 349 " --" << kChromeFrame << " --" << kCeee; |
| 350 |
| 351 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); |
| 352 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); |
| 353 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); |
| 354 CommandLine chrome_cf_install(CommandLine::FromString(chrome_cf_cmd.str())); |
362 CommandLine chrome_cf_ceee_install( | 355 CommandLine chrome_cf_ceee_install( |
363 CommandLine::FromString(kChromeCeeeCfInstall)); | 356 CommandLine::FromString(chrome_ceee_cf_cmd.str())); |
364 | 357 |
365 installer_util::MasterPreferences pref_chrome(chrome_install); | 358 installer_util::MasterPreferences pref_chrome(chrome_install); |
366 installer_util::MasterPreferences pref_cf(cf_install); | 359 installer_util::MasterPreferences pref_cf(cf_install); |
367 installer_util::MasterPreferences pref_ceee(ceee_install); | 360 installer_util::MasterPreferences pref_ceee(ceee_install); |
368 installer_util::MasterPreferences pref_chrome_cf(chrome_cf_install); | 361 installer_util::MasterPreferences pref_chrome_cf(chrome_cf_install); |
369 installer_util::MasterPreferences pref_all(chrome_cf_ceee_install); | 362 installer_util::MasterPreferences pref_all(chrome_cf_ceee_install); |
370 | 363 |
371 EXPECT_TRUE(pref_chrome.is_multi_install()); | 364 EXPECT_TRUE(pref_chrome.is_multi_install()); |
372 EXPECT_TRUE(pref_chrome.install_chrome()); | 365 EXPECT_TRUE(pref_chrome.install_chrome()); |
373 EXPECT_FALSE(pref_chrome.install_ceee()); | 366 EXPECT_FALSE(pref_chrome.install_ceee()); |
(...skipping 13 matching lines...) Expand all Loading... |
387 EXPECT_TRUE(pref_chrome_cf.install_chrome()); | 380 EXPECT_TRUE(pref_chrome_cf.install_chrome()); |
388 EXPECT_FALSE(pref_chrome_cf.install_ceee()); | 381 EXPECT_FALSE(pref_chrome_cf.install_ceee()); |
389 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); | 382 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); |
390 | 383 |
391 EXPECT_TRUE(pref_all.is_multi_install()); | 384 EXPECT_TRUE(pref_all.is_multi_install()); |
392 EXPECT_TRUE(pref_all.install_chrome()); | 385 EXPECT_TRUE(pref_all.install_chrome()); |
393 EXPECT_TRUE(pref_all.install_ceee()); | 386 EXPECT_TRUE(pref_all.install_ceee()); |
394 EXPECT_TRUE(pref_all.install_chrome_frame()); | 387 EXPECT_TRUE(pref_all.install_chrome_frame()); |
395 } | 388 } |
396 | 389 |
OLD | NEW |