OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/component_updater/test/test_installer.h" | 5 #include "chrome/browser/component_updater/test/test_installer.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 bool ReadOnlyTestInstaller::GetInstalledFile(const std::string& file, | 42 bool ReadOnlyTestInstaller::GetInstalledFile(const std::string& file, |
43 base::FilePath* installed_file) { | 43 base::FilePath* installed_file) { |
44 *installed_file = install_directory_.AppendASCII(file); | 44 *installed_file = install_directory_.AppendASCII(file); |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 VersionedTestInstaller::VersionedTestInstaller() { | 49 VersionedTestInstaller::VersionedTestInstaller() { |
50 file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("TEST_"), | 50 base::CreateNewTempDirectory(FILE_PATH_LITERAL("TEST_"), &install_directory_); |
51 &install_directory_); | |
52 } | 51 } |
53 | 52 |
54 VersionedTestInstaller::~VersionedTestInstaller() { | 53 VersionedTestInstaller::~VersionedTestInstaller() { |
55 base::DeleteFile(install_directory_, true); | 54 base::DeleteFile(install_directory_, true); |
56 } | 55 } |
57 | 56 |
58 | 57 |
59 bool VersionedTestInstaller::Install(const base::DictionaryValue& manifest, | 58 bool VersionedTestInstaller::Install(const base::DictionaryValue& manifest, |
60 const base::FilePath& unpack_path) { | 59 const base::FilePath& unpack_path) { |
61 std::string version_string; | 60 std::string version_string; |
(...skipping 10 matching lines...) Expand all Loading... |
72 return true; | 71 return true; |
73 } | 72 } |
74 | 73 |
75 bool VersionedTestInstaller::GetInstalledFile(const std::string& file, | 74 bool VersionedTestInstaller::GetInstalledFile(const std::string& file, |
76 base::FilePath* installed_file) { | 75 base::FilePath* installed_file) { |
77 base::FilePath path; | 76 base::FilePath path; |
78 path = install_directory_.AppendASCII(current_version_.GetString()); | 77 path = install_directory_.AppendASCII(current_version_.GetString()); |
79 *installed_file = path.Append(base::FilePath::FromUTF8Unsafe(file)); | 78 *installed_file = path.Append(base::FilePath::FromUTF8Unsafe(file)); |
80 return true; | 79 return true; |
81 } | 80 } |
OLD | NEW |