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

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

Issue 3817001: CommandLine: remove wstring-based program() accessor (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 TEST_F(SetupUtilTest, ApplyDiffPatchTest) { 48 TEST_F(SetupUtilTest, ApplyDiffPatchTest) {
49 FilePath work_dir(test_dir_); 49 FilePath work_dir(test_dir_);
50 work_dir = work_dir.AppendASCII("ApplyDiffPatchTest"); 50 work_dir = work_dir.AppendASCII("ApplyDiffPatchTest");
51 ASSERT_FALSE(file_util::PathExists(work_dir)); 51 ASSERT_FALSE(file_util::PathExists(work_dir));
52 EXPECT_TRUE(file_util::CreateDirectory(work_dir)); 52 EXPECT_TRUE(file_util::CreateDirectory(work_dir));
53 ASSERT_TRUE(file_util::PathExists(work_dir)); 53 ASSERT_TRUE(file_util::PathExists(work_dir));
54 54
55 FilePath src = data_dir_.AppendASCII("archive1.7z"); 55 FilePath src = data_dir_.AppendASCII("archive1.7z");
56 FilePath patch = data_dir_.AppendASCII("archive.diff"); 56 FilePath patch = data_dir_.AppendASCII("archive.diff");
57 FilePath dest = work_dir.AppendASCII("archive2.7z"); 57 FilePath dest = work_dir.AppendASCII("archive2.7z");
58 EXPECT_EQ(setup_util::ApplyDiffPatch(src.value(), patch.value(), 58 EXPECT_EQ(setup_util::ApplyDiffPatch(src, patch, dest), 0);
59 dest.value()), 0);
60 FilePath base = data_dir_.AppendASCII("archive2.7z"); 59 FilePath base = data_dir_.AppendASCII("archive2.7z");
61 EXPECT_TRUE(file_util::ContentsEqual(dest, base)); 60 EXPECT_TRUE(file_util::ContentsEqual(dest, base));
62 61
63 EXPECT_EQ(setup_util::ApplyDiffPatch(L"", L"", L""), 6); 62 EXPECT_EQ(setup_util::ApplyDiffPatch(FilePath(), FilePath(), FilePath()), 6);
64 } 63 }
65 64
66 // Test that we are parsing Chrome version correctly. 65 // Test that we are parsing Chrome version correctly.
67 TEST_F(SetupUtilTest, GetVersionFromDirTest) { 66 TEST_F(SetupUtilTest, GetVersionFromDirTest) {
68 // Create a version dir 67 // Create a version dir
69 FilePath chrome_dir = test_dir_.AppendASCII("1.0.0.0"); 68 FilePath chrome_dir = test_dir_.AppendASCII("1.0.0.0");
70 file_util::CreateDirectory(chrome_dir); 69 file_util::CreateDirectory(chrome_dir);
71 ASSERT_TRUE(file_util::PathExists(chrome_dir)); 70 ASSERT_TRUE(file_util::PathExists(chrome_dir));
72 scoped_ptr<installer::Version> version( 71 scoped_ptr<installer::Version> version(
73 setup_util::GetVersionFromDir(test_dir_.value())); 72 setup_util::GetVersionFromDir(test_dir_));
74 ASSERT_TRUE(version->GetString() == L"1.0.0.0"); 73 ASSERT_TRUE(version->GetString() == L"1.0.0.0");
75 74
76 file_util::Delete(chrome_dir, true); 75 file_util::Delete(chrome_dir, true);
77 ASSERT_FALSE(file_util::PathExists(chrome_dir)); 76 ASSERT_FALSE(file_util::PathExists(chrome_dir));
78 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); 77 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_) == NULL);
79 78
80 chrome_dir = test_dir_.AppendASCII("ABC"); 79 chrome_dir = test_dir_.AppendASCII("ABC");
81 file_util::CreateDirectory(chrome_dir); 80 file_util::CreateDirectory(chrome_dir);
82 ASSERT_TRUE(file_util::PathExists(chrome_dir)); 81 ASSERT_TRUE(file_util::PathExists(chrome_dir));
83 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); 82 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_) == NULL);
84 83
85 chrome_dir = test_dir_.AppendASCII("2.3.4.5"); 84 chrome_dir = test_dir_.AppendASCII("2.3.4.5");
86 file_util::CreateDirectory(chrome_dir); 85 file_util::CreateDirectory(chrome_dir);
87 ASSERT_TRUE(file_util::PathExists(chrome_dir)); 86 ASSERT_TRUE(file_util::PathExists(chrome_dir));
88 version.reset(setup_util::GetVersionFromDir(test_dir_.value())); 87 version.reset(setup_util::GetVersionFromDir(test_dir_));
89 ASSERT_TRUE(version->GetString() == L"2.3.4.5"); 88 ASSERT_TRUE(version->GetString() == L"2.3.4.5");
90 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698