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 <vector> | 6 #include <vector> |
6 | 7 |
7 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 CldComponentInstallerTraits::GetInstalledPath(base_dir); | 95 CldComponentInstallerTraits::GetInstalledPath(base_dir); |
95 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); | 96 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); |
96 } | 97 } |
97 | 98 |
98 TEST_F(CldComponentInstallerTest, GetBaseDirectory) { | 99 TEST_F(CldComponentInstallerTest, GetBaseDirectory) { |
99 const base::FilePath result = traits_.GetBaseDirectory(); | 100 const base::FilePath result = traits_.GetBaseDirectory(); |
100 ASSERT_FALSE(result.empty()); | 101 ASSERT_FALSE(result.empty()); |
101 } | 102 } |
102 | 103 |
103 TEST_F(CldComponentInstallerTest, GetHash) { | 104 TEST_F(CldComponentInstallerTest, GetHash) { |
104 std::vector<uint8> hash; | 105 std::vector<uint8_t> hash; |
105 traits_.GetHash(&hash); | 106 traits_.GetHash(&hash); |
106 ASSERT_EQ(static_cast<size_t>(32), hash.size()); | 107 ASSERT_EQ(static_cast<size_t>(32), hash.size()); |
107 } | 108 } |
108 | 109 |
109 TEST_F(CldComponentInstallerTest, GetName) { | 110 TEST_F(CldComponentInstallerTest, GetName) { |
110 ASSERT_FALSE(traits_.GetName().empty()); | 111 ASSERT_FALSE(traits_.GetName().empty()); |
111 } | 112 } |
112 | 113 |
113 TEST_F(CldComponentInstallerTest, ComponentReady) { | 114 TEST_F(CldComponentInstallerTest, ComponentReady) { |
114 scoped_ptr<base::DictionaryValue> manifest; | 115 scoped_ptr<base::DictionaryValue> manifest; |
115 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); | 116 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); |
116 const base::Version version("1.2.3.4"); | 117 const base::Version version("1.2.3.4"); |
117 traits_.ComponentReady(version, install_dir, manifest.Pass()); | 118 traits_.ComponentReady(version, install_dir, manifest.Pass()); |
118 base::FilePath result = | 119 base::FilePath result = |
119 CldComponentInstallerTraits::GetLatestCldDataFile(); | 120 CldComponentInstallerTraits::GetLatestCldDataFile(); |
120 ASSERT_TRUE(StartsWith(result.AsUTF16Unsafe(), | 121 ASSERT_TRUE(StartsWith(result.AsUTF16Unsafe(), |
121 install_dir.AsUTF16Unsafe(), | 122 install_dir.AsUTF16Unsafe(), |
122 true)); | 123 true)); |
123 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); | 124 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); |
124 } | 125 } |
125 | 126 |
126 } // namespace component_updater | 127 } // namespace component_updater |
OLD | NEW |