Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Side by Side Diff: chrome/installer/setup/setup_util_unittest.cc

Issue 164537: Renames the function CreateTemporaryFilename to CreateTemporaryFile and track... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: CommandLine fix Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 dest.value()), 0); 59 dest.value()), 0);
60 FilePath base = data_dir_.AppendASCII("archive2.7z"); 60 FilePath base = data_dir_.AppendASCII("archive2.7z");
61 EXPECT_TRUE(file_util::ContentsEqual(dest, base)); 61 EXPECT_TRUE(file_util::ContentsEqual(dest, base));
62 62
63 EXPECT_EQ(setup_util::ApplyDiffPatch(L"", L"", L""), 6); 63 EXPECT_EQ(setup_util::ApplyDiffPatch(L"", L"", L""), 6);
64 } 64 }
65 65
66 // Test that we are parsing master preferences correctly. 66 // Test that we are parsing master preferences correctly.
67 TEST_F(SetupUtilTest, GetInstallPreferencesTest) { 67 TEST_F(SetupUtilTest, GetInstallPreferencesTest) {
68 // Create a temporary prefs file. 68 // Create a temporary prefs file.
69 std::wstring prefs_file; 69 FilePath prefs_file;
70 ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs_file)); 70 ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file));
71 const char text[] = 71 const char text[] =
72 "{ \n" 72 "{ \n"
73 " \"distribution\": { \n" 73 " \"distribution\": { \n"
74 " \"skip_first_run_ui\": true,\n" 74 " \"skip_first_run_ui\": true,\n"
75 " \"create_all_shortcuts\": false,\n" 75 " \"create_all_shortcuts\": false,\n"
76 " \"do_not_launch_chrome\": true,\n" 76 " \"do_not_launch_chrome\": true,\n"
77 " \"system_level\": true,\n" 77 " \"system_level\": true,\n"
78 " \"verbose_logging\": false\n" 78 " \"verbose_logging\": false\n"
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(L"setup.exe --installerdata=\"" + prefs_file + L"\""); 84 std::wstring cmd_str(
85 L"setup.exe --installerdata=\"" + prefs_file.value() + L"\"");
85 cmd_str.append(L" --create-all-shortcuts"); 86 cmd_str.append(L" --create-all-shortcuts");
86 cmd_str.append(L" --do-not-launch-chrome"); 87 cmd_str.append(L" --do-not-launch-chrome");
87 cmd_str.append(L" --alt-desktop-shortcut"); 88 cmd_str.append(L" --alt-desktop-shortcut");
88 CommandLine cmd_line(L""); 89 CommandLine cmd_line(L"");
89 cmd_line.ParseFromString(cmd_str); 90 cmd_line.ParseFromString(cmd_str);
90 scoped_ptr<DictionaryValue> prefs( 91 scoped_ptr<DictionaryValue> prefs(
91 setup_util::GetInstallPreferences(cmd_line)); 92 setup_util::GetInstallPreferences(cmd_line));
92 EXPECT_TRUE(prefs.get() != NULL); 93 EXPECT_TRUE(prefs.get() != NULL);
93 94
94 // Check prefs that do not have any equivalent command line option. 95 // Check prefs that do not have any equivalent command line option.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ASSERT_TRUE(file_util::PathExists(chrome_dir)); 153 ASSERT_TRUE(file_util::PathExists(chrome_dir));
153 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); 154 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL);
154 155
155 chrome_dir = test_dir_.value(); 156 chrome_dir = test_dir_.value();
156 file_util::AppendToPath(&chrome_dir, L"2.3.4.5"); 157 file_util::AppendToPath(&chrome_dir, L"2.3.4.5");
157 CreateDirectory(chrome_dir.c_str(), NULL); 158 CreateDirectory(chrome_dir.c_str(), NULL);
158 ASSERT_TRUE(file_util::PathExists(chrome_dir)); 159 ASSERT_TRUE(file_util::PathExists(chrome_dir));
159 version.reset(setup_util::GetVersionFromDir(test_dir_.value())); 160 version.reset(setup_util::GetVersionFromDir(test_dir_.value()));
160 ASSERT_TRUE(version->GetString() == L"2.3.4.5"); 161 ASSERT_TRUE(version->GetString() == L"2.3.4.5");
161 } 162 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/file_system_accessor_unittest.cc ('k') | chrome/installer/setup/uninstall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698