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(base::EndsWith(result.value(), kTestCldDataFileName, true)); | 105 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, |
| 106 base::CompareCase::SENSITIVE)); |
106 } | 107 } |
107 | 108 |
108 TEST_F(CldComponentInstallerTest, GetBaseDirectory) { | 109 TEST_F(CldComponentInstallerTest, GetBaseDirectory) { |
109 const base::FilePath result = traits_.GetBaseDirectory(); | 110 const base::FilePath result = traits_.GetBaseDirectory(); |
110 ASSERT_FALSE(result.empty()); | 111 ASSERT_FALSE(result.empty()); |
111 } | 112 } |
112 | 113 |
113 TEST_F(CldComponentInstallerTest, GetHash) { | 114 TEST_F(CldComponentInstallerTest, GetHash) { |
114 std::vector<uint8_t> hash; | 115 std::vector<uint8_t> hash; |
115 traits_.GetHash(&hash); | 116 traits_.GetHash(&hash); |
116 ASSERT_EQ(static_cast<size_t>(32), hash.size()); | 117 ASSERT_EQ(static_cast<size_t>(32), hash.size()); |
117 } | 118 } |
118 | 119 |
119 TEST_F(CldComponentInstallerTest, GetName) { | 120 TEST_F(CldComponentInstallerTest, GetName) { |
120 ASSERT_FALSE(traits_.GetName().empty()); | 121 ASSERT_FALSE(traits_.GetName().empty()); |
121 } | 122 } |
122 | 123 |
123 TEST_F(CldComponentInstallerTest, ComponentReady) { | 124 TEST_F(CldComponentInstallerTest, ComponentReady) { |
124 scoped_ptr<base::DictionaryValue> manifest; | 125 scoped_ptr<base::DictionaryValue> manifest; |
125 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); | 126 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); |
126 const base::Version version("1.2.3.4"); | 127 const base::Version version("1.2.3.4"); |
127 traits_.ComponentReady(version, install_dir, manifest.Pass()); | 128 traits_.ComponentReady(version, install_dir, manifest.Pass()); |
128 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); | 129 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); |
129 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), | 130 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), |
130 install_dir.AsUTF16Unsafe(), true)); | 131 install_dir.AsUTF16Unsafe(), |
131 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, true)); | 132 base::CompareCase::SENSITIVE)); |
| 133 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, |
| 134 base::CompareCase::SENSITIVE)); |
132 } | 135 } |
133 | 136 |
134 } // namespace component_updater | 137 } // namespace component_updater |
OLD | NEW |