OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 " }\n" | 79 " }\n" |
80 "} \n"; | 80 "} \n"; |
81 EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); | 81 EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); |
82 | 82 |
83 // Make sure command line values override the values in master preferences. | 83 // Make sure command line values override the values in master preferences. |
84 std::wstring cmd_str( | 84 std::wstring cmd_str( |
85 L"setup.exe --installerdata=\"" + prefs_file.value() + L"\""); | 85 L"setup.exe --installerdata=\"" + prefs_file.value() + L"\""); |
86 cmd_str.append(L" --create-all-shortcuts"); | 86 cmd_str.append(L" --create-all-shortcuts"); |
87 cmd_str.append(L" --do-not-launch-chrome"); | 87 cmd_str.append(L" --do-not-launch-chrome"); |
88 cmd_str.append(L" --alt-desktop-shortcut"); | 88 cmd_str.append(L" --alt-desktop-shortcut"); |
89 CommandLine cmd_line(L""); | 89 CommandLine cmd_line = CommandLine::FromString(cmd_str); |
90 cmd_line.ParseFromString(cmd_str); | |
91 scoped_ptr<DictionaryValue> prefs( | 90 scoped_ptr<DictionaryValue> prefs( |
92 setup_util::GetInstallPreferences(cmd_line)); | 91 setup_util::GetInstallPreferences(cmd_line)); |
93 EXPECT_TRUE(prefs.get() != NULL); | 92 EXPECT_TRUE(prefs.get() != NULL); |
94 | 93 |
95 // Check prefs that do not have any equivalent command line option. | 94 // Check prefs that do not have any equivalent command line option. |
96 bool value = false; | 95 bool value = false; |
97 EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), | 96 EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), |
98 installer_util::master_preferences::kDistroSkipFirstRunPref, &value) && | 97 installer_util::master_preferences::kDistroSkipFirstRunPref, &value) && |
99 value); | 98 value); |
100 EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(), | 99 EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 file_util::CreateDirectory(chrome_dir); | 159 file_util::CreateDirectory(chrome_dir); |
161 ASSERT_TRUE(file_util::PathExists(chrome_dir)); | 160 ASSERT_TRUE(file_util::PathExists(chrome_dir)); |
162 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); | 161 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); |
163 | 162 |
164 chrome_dir = test_dir_.AppendASCII("2.3.4.5"); | 163 chrome_dir = test_dir_.AppendASCII("2.3.4.5"); |
165 file_util::CreateDirectory(chrome_dir); | 164 file_util::CreateDirectory(chrome_dir); |
166 ASSERT_TRUE(file_util::PathExists(chrome_dir)); | 165 ASSERT_TRUE(file_util::PathExists(chrome_dir)); |
167 version.reset(setup_util::GetVersionFromDir(test_dir_.value())); | 166 version.reset(setup_util::GetVersionFromDir(test_dir_.value())); |
168 ASSERT_TRUE(version->GetString() == L"2.3.4.5"); | 167 ASSERT_TRUE(version->GetString() == L"2.3.4.5"); |
169 } | 168 } |
OLD | NEW |