OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/installer/util/master_preferences.h" | 7 #include "chrome/installer/util/master_preferences.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { | 316 TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { |
317 std::wstringstream chrome_cmd; | 317 std::wstringstream chrome_cmd; |
318 chrome_cmd << "setup.exe"; | 318 chrome_cmd << "setup.exe"; |
319 | 319 |
320 base::CommandLine chrome_install( | 320 base::CommandLine chrome_install( |
321 base::CommandLine::FromString(chrome_cmd.str())); | 321 base::CommandLine::FromString(chrome_cmd.str())); |
322 | 322 |
323 installer::MasterPreferences pref_chrome(chrome_install); | 323 installer::MasterPreferences pref_chrome(chrome_install); |
324 | 324 |
325 EXPECT_FALSE(pref_chrome.is_multi_install()); | 325 EXPECT_FALSE(pref_chrome.is_multi_install()); |
326 EXPECT_TRUE(pref_chrome.install_chrome()); | |
327 } | 326 } |
328 | 327 |
329 TEST_F(MasterPreferencesTest, TestMultiInstallIgnoredConfig) { | 328 TEST_F(MasterPreferencesTest, TestMultiInstallIgnoredConfig) { |
330 using installer::switches::kMultiInstall; | 329 using installer::switches::kMultiInstall; |
331 using installer::switches::kChrome; | 330 using installer::switches::kChrome; |
332 | 331 |
333 std::wstringstream chrome_cmd, cf_cmd, chrome_cf_cmd; | 332 std::wstringstream chrome_cmd, cf_cmd, chrome_cf_cmd; |
334 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; | 333 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; |
335 | 334 |
336 base::CommandLine chrome_install( | 335 base::CommandLine chrome_install( |
337 base::CommandLine::FromString(chrome_cmd.str())); | 336 base::CommandLine::FromString(chrome_cmd.str())); |
338 | 337 |
339 installer::MasterPreferences pref_chrome(chrome_install); | 338 installer::MasterPreferences pref_chrome(chrome_install); |
340 | 339 |
341 EXPECT_FALSE(pref_chrome.is_multi_install()); | 340 EXPECT_FALSE(pref_chrome.is_multi_install()); |
342 EXPECT_TRUE(pref_chrome.install_chrome()); | |
343 } | 341 } |
344 | 342 |
345 TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) { | 343 TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) { |
346 static const char kCreateAllShortcutsFalsePrefs[] = | 344 static const char kCreateAllShortcutsFalsePrefs[] = |
347 "{" | 345 "{" |
348 " \"distribution\": {" | 346 " \"distribution\": {" |
349 " \"create_all_shortcuts\": false" | 347 " \"create_all_shortcuts\": false" |
350 " }" | 348 " }" |
351 "}"; | 349 "}"; |
352 | 350 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 451 } |
454 { | 452 { |
455 ScopedGoogleUpdateIsMachine env_setter("2"); | 453 ScopedGoogleUpdateIsMachine env_setter("2"); |
456 installer::MasterPreferences prefs( | 454 installer::MasterPreferences prefs( |
457 base::CommandLine(base::FilePath(FILE_PATH_LITERAL("setup.exe")))); | 455 base::CommandLine(base::FilePath(FILE_PATH_LITERAL("setup.exe")))); |
458 bool value = false; | 456 bool value = false; |
459 prefs.GetBool(installer::master_preferences::kSystemLevel, &value); | 457 prefs.GetBool(installer::master_preferences::kSystemLevel, &value); |
460 EXPECT_FALSE(value); | 458 EXPECT_FALSE(value); |
461 } | 459 } |
462 } | 460 } |
OLD | NEW |