| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 installer_util::master_preferences::kAltShortcutText)); | 128 installer_util::master_preferences::kAltShortcutText)); |
| 129 EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(), | 129 EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(), |
| 130 installer_util::master_preferences::kSystemLevel)); | 130 installer_util::master_preferences::kSystemLevel)); |
| 131 EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(), | 131 EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(), |
| 132 installer_util::master_preferences::kVerboseLogging)); | 132 installer_util::master_preferences::kVerboseLogging)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Test that we are parsing Chrome version correctly. | 135 // Test that we are parsing Chrome version correctly. |
| 136 TEST_F(SetupUtilTest, GetVersionFromDirTest) { | 136 TEST_F(SetupUtilTest, GetVersionFromDirTest) { |
| 137 // Create a version dir | 137 // Create a version dir |
| 138 std::wstring chrome_dir(test_dir_.value()); | 138 FilePath chrome_dir = test_dir_.AppendASCII("1.0.0.0"); |
| 139 file_util::AppendToPath(&chrome_dir, L"1.0.0.0"); | 139 file_util::CreateDirectory(chrome_dir); |
| 140 CreateDirectory(chrome_dir.c_str(), NULL); | |
| 141 ASSERT_TRUE(file_util::PathExists(chrome_dir)); | 140 ASSERT_TRUE(file_util::PathExists(chrome_dir)); |
| 142 scoped_ptr<installer::Version> version( | 141 scoped_ptr<installer::Version> version( |
| 143 setup_util::GetVersionFromDir(test_dir_.value())); | 142 setup_util::GetVersionFromDir(test_dir_.value())); |
| 144 ASSERT_TRUE(version->GetString() == L"1.0.0.0"); | 143 ASSERT_TRUE(version->GetString() == L"1.0.0.0"); |
| 145 | 144 |
| 146 file_util::Delete(chrome_dir, true); | 145 file_util::Delete(chrome_dir, true); |
| 147 ASSERT_FALSE(file_util::PathExists(chrome_dir)); | 146 ASSERT_FALSE(file_util::PathExists(chrome_dir)); |
| 148 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); | 147 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); |
| 149 | 148 |
| 150 chrome_dir = test_dir_.value(); | 149 chrome_dir = test_dir_.AppendASCII("ABC"); |
| 151 file_util::AppendToPath(&chrome_dir, L"ABC"); | 150 file_util::CreateDirectory(chrome_dir); |
| 152 CreateDirectory(chrome_dir.c_str(), NULL); | |
| 153 ASSERT_TRUE(file_util::PathExists(chrome_dir)); | 151 ASSERT_TRUE(file_util::PathExists(chrome_dir)); |
| 154 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); | 152 ASSERT_TRUE(setup_util::GetVersionFromDir(test_dir_.value()) == NULL); |
| 155 | 153 |
| 156 chrome_dir = test_dir_.value(); | 154 chrome_dir = test_dir_.AppendASCII("2.3.4.5"); |
| 157 file_util::AppendToPath(&chrome_dir, L"2.3.4.5"); | 155 file_util::CreateDirectory(chrome_dir); |
| 158 CreateDirectory(chrome_dir.c_str(), NULL); | |
| 159 ASSERT_TRUE(file_util::PathExists(chrome_dir)); | 156 ASSERT_TRUE(file_util::PathExists(chrome_dir)); |
| 160 version.reset(setup_util::GetVersionFromDir(test_dir_.value())); | 157 version.reset(setup_util::GetVersionFromDir(test_dir_.value())); |
| 161 ASSERT_TRUE(version->GetString() == L"2.3.4.5"); | 158 ASSERT_TRUE(version->GetString() == L"2.3.4.5"); |
| 162 } | 159 } |
| OLD | NEW |