OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const base::DictionaryValue manifest; | 95 const base::DictionaryValue manifest; |
96 const base::FilePath install_dir; | 96 const base::FilePath install_dir; |
97 // Sanity: shouldn't crash. | 97 // Sanity: shouldn't crash. |
98 ASSERT_TRUE(traits_.OnCustomInstall(manifest, install_dir)); | 98 ASSERT_TRUE(traits_.OnCustomInstall(manifest, install_dir)); |
99 } | 99 } |
100 | 100 |
101 TEST_F(CldComponentInstallerTest, GetInstalledPath) { | 101 TEST_F(CldComponentInstallerTest, GetInstalledPath) { |
102 const base::FilePath base_dir; | 102 const base::FilePath base_dir; |
103 const base::FilePath result = | 103 const base::FilePath result = |
104 CldComponentInstallerTraits::GetInstalledPath(base_dir); | 104 CldComponentInstallerTraits::GetInstalledPath(base_dir); |
105 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); | 105 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, true)); |
106 } | 106 } |
107 | 107 |
108 TEST_F(CldComponentInstallerTest, GetBaseDirectory) { | 108 TEST_F(CldComponentInstallerTest, GetBaseDirectory) { |
109 const base::FilePath result = traits_.GetBaseDirectory(); | 109 const base::FilePath result = traits_.GetBaseDirectory(); |
110 ASSERT_FALSE(result.empty()); | 110 ASSERT_FALSE(result.empty()); |
111 } | 111 } |
112 | 112 |
113 TEST_F(CldComponentInstallerTest, GetHash) { | 113 TEST_F(CldComponentInstallerTest, GetHash) { |
114 std::vector<uint8_t> hash; | 114 std::vector<uint8_t> hash; |
115 traits_.GetHash(&hash); | 115 traits_.GetHash(&hash); |
116 ASSERT_EQ(static_cast<size_t>(32), hash.size()); | 116 ASSERT_EQ(static_cast<size_t>(32), hash.size()); |
117 } | 117 } |
118 | 118 |
119 TEST_F(CldComponentInstallerTest, GetName) { | 119 TEST_F(CldComponentInstallerTest, GetName) { |
120 ASSERT_FALSE(traits_.GetName().empty()); | 120 ASSERT_FALSE(traits_.GetName().empty()); |
121 } | 121 } |
122 | 122 |
123 TEST_F(CldComponentInstallerTest, ComponentReady) { | 123 TEST_F(CldComponentInstallerTest, ComponentReady) { |
124 scoped_ptr<base::DictionaryValue> manifest; | 124 scoped_ptr<base::DictionaryValue> manifest; |
125 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); | 125 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); |
126 const base::Version version("1.2.3.4"); | 126 const base::Version version("1.2.3.4"); |
127 traits_.ComponentReady(version, install_dir, manifest.Pass()); | 127 traits_.ComponentReady(version, install_dir, manifest.Pass()); |
128 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); | 128 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); |
129 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), | 129 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), |
130 install_dir.AsUTF16Unsafe(), true)); | 130 install_dir.AsUTF16Unsafe(), true)); |
131 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); | 131 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, true)); |
132 } | 132 } |
133 | 133 |
134 } // namespace component_updater | 134 } // namespace component_updater |
OLD | NEW |