Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 1 | // Copyright 2016 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Chan | 045849f | 2017-12-18 17:27:07 -0800 | [diff] [blame] | 5 | #include "imageloader/component.h" |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 6 | |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | #include <list> |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 10 | #include <memory> |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 11 | #include <string> |
| 12 | #include <vector> |
| 13 | |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 14 | #include <base/files/file_path.h> |
| 15 | #include <base/files/file_util.h> |
| 16 | #include <base/files/scoped_temp_dir.h> |
| 17 | #include <base/logging.h> |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 18 | #include <crypto/secure_hash.h> |
| 19 | #include <crypto/sha2.h> |
| 20 | #include <gmock/gmock.h> |
| 21 | #include <gtest/gtest.h> |
| 22 | |
Ben Chan | 045849f | 2017-12-18 17:27:07 -0800 | [diff] [blame] | 23 | #include "imageloader/imageloader_impl.h" |
Greg Kerr | 09f06de | 2018-02-16 15:32:07 -0800 | [diff] [blame] | 24 | #include "imageloader/mock_helper_process_proxy.h" |
Ben Chan | 045849f | 2017-12-18 17:27:07 -0800 | [diff] [blame] | 25 | #include "imageloader/test_utilities.h" |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 26 | |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 27 | namespace imageloader { |
| 28 | |
| 29 | using testing::_; |
| 30 | |
| 31 | class ComponentTest : public testing::Test { |
| 32 | public: |
| 33 | ComponentTest() { |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 34 | keys_.push_back(std::vector<uint8_t>(std::begin(kDevPublicKey), |
| 35 | std::end(kDevPublicKey))); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 36 | CHECK(scoped_temp_dir_.CreateUniqueTempDir()); |
Eric Caruso | a5dfc94 | 2018-01-22 15:44:45 -0800 | [diff] [blame] | 37 | temp_dir_ = scoped_temp_dir_.GetPath(); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 38 | CHECK(base::SetPosixFilePermissions(temp_dir_, kComponentDirPerms)); |
| 39 | } |
| 40 | |
| 41 | bool TestCopyWithCorruptFile(const std::string& component_name, |
| 42 | const std::string& file_name) { |
| 43 | base::FilePath bad_component_dir = temp_dir_.Append(component_name); |
Colin Howes | ad6271a | 2018-11-21 15:36:05 -0800 | [diff] [blame] | 44 | if (!base::CreateDirectory(bad_component_dir)) |
| 45 | return false; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 46 | if (!base::SetPosixFilePermissions(bad_component_dir, kComponentDirPerms)) |
| 47 | return false; |
| 48 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 49 | std::unique_ptr<Component> component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 50 | Component::Create(GetTestComponentPath(), keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 51 | if (!component || !component->CopyTo(bad_component_dir)) |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 52 | return false; |
| 53 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 54 | std::unique_ptr<Component> bad_component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 55 | Component::Create(bad_component_dir, keys_); |
Colin Howes | ad6271a | 2018-11-21 15:36:05 -0800 | [diff] [blame] | 56 | if (!bad_component) |
| 57 | return false; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 58 | |
| 59 | base::FilePath file = bad_component_dir.Append(file_name); |
| 60 | const char data[] = "c"; |
Colin Howes | ad6271a | 2018-11-21 15:36:05 -0800 | [diff] [blame] | 61 | if (!base::AppendToFile(file, data, sizeof(data))) |
| 62 | return false; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 63 | |
| 64 | base::FilePath bad_component_dest = |
| 65 | temp_dir_.Append(component_name + "invalid"); |
Colin Howes | ad6271a | 2018-11-21 15:36:05 -0800 | [diff] [blame] | 66 | if (!base::CreateDirectory(bad_component_dest)) |
| 67 | return false; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 68 | |
| 69 | if (!base::SetPosixFilePermissions(bad_component_dest, kComponentDirPerms)) |
| 70 | return false; |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 71 | return bad_component->CopyTo(bad_component_dest) == false; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | bool TestInitComponentWithCorruptFile(const std::string& component_name, |
| 75 | const std::string& file_name) { |
| 76 | base::FilePath bad_component_dir = temp_dir_.Append(component_name); |
Colin Howes | ad6271a | 2018-11-21 15:36:05 -0800 | [diff] [blame] | 77 | if (!base::CreateDirectory(bad_component_dir)) |
| 78 | return false; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 79 | if (!base::SetPosixFilePermissions(bad_component_dir, kComponentDirPerms)) |
| 80 | return false; |
| 81 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 82 | std::unique_ptr<Component> component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 83 | Component::Create(GetTestComponentPath(), keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 84 | if (!component || !component->CopyTo(bad_component_dir)) |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 85 | return false; |
| 86 | |
| 87 | base::FilePath file = bad_component_dir.Append(file_name); |
| 88 | // Read the file out and change the last byte. |
| 89 | std::string file_contents; |
Colin Howes | ad6271a | 2018-11-21 15:36:05 -0800 | [diff] [blame] | 90 | if (!base::ReadFileToString(file, &file_contents)) |
| 91 | return false; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 92 | file_contents[file_contents.size() - 1] = |
| 93 | ~file_contents[file_contents.size() - 1]; |
| 94 | |
| 95 | if (!base::WriteFile(file, file_contents.data(), file_contents.size())) { |
| 96 | return false; |
| 97 | } |
| 98 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 99 | std::unique_ptr<Component> bad_component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 100 | Component::Create(bad_component_dir, keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 101 | return bad_component == nullptr; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | bool CompareFileContents(const base::FilePath& src, |
| 105 | const base::FilePath& dest, |
| 106 | const std::list<std::string>& filenames) { |
| 107 | for (const std::string& name : filenames) { |
| 108 | std::string source_file_contents; |
| 109 | std::string dest_file_contents; |
| 110 | if (!base::ReadFileToString(src.Append(name), &source_file_contents)) |
| 111 | return false; |
| 112 | if (!base::ReadFileToString(dest.Append(name), &dest_file_contents)) |
| 113 | return false; |
| 114 | if (source_file_contents != dest_file_contents) { |
| 115 | LOG(ERROR) << "File contents does not match for file: " << name; |
| 116 | return false; |
| 117 | } |
| 118 | } |
| 119 | return true; |
| 120 | } |
| 121 | |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 122 | Keys keys_; |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 123 | base::ScopedTempDir scoped_temp_dir_; |
| 124 | base::FilePath temp_dir_; |
| 125 | }; |
| 126 | |
| 127 | TEST_F(ComponentTest, InitComponentAndCheckManifest) { |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 128 | std::unique_ptr<Component> component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 129 | Component::Create(GetTestComponentPath(), keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 130 | ASSERT_NE(nullptr, component); |
| 131 | |
Xiaochu Liu | c209aab | 2018-06-19 13:42:15 -0700 | [diff] [blame] | 132 | EXPECT_EQ(1, component->manifest().manifest_version()); |
| 133 | EXPECT_EQ(kTestDataVersion, component->manifest().version()); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 134 | // Don't hardcode the sha256 hashes, but run some sanity checks. |
Xiaochu Liu | c209aab | 2018-06-19 13:42:15 -0700 | [diff] [blame] | 135 | EXPECT_EQ(crypto::kSHA256Length, component->manifest().image_sha256().size()); |
| 136 | EXPECT_EQ(crypto::kSHA256Length, component->manifest().table_sha256().size()); |
| 137 | EXPECT_NE(component->manifest().image_sha256(), |
| 138 | component->manifest().table_sha256()); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 139 | } |
| 140 | |
Xiaochu Liu | c226434 | 2017-08-14 16:37:42 -0700 | [diff] [blame] | 141 | TEST_F(ComponentTest, TestCopyAndMountComponentExt4) { |
| 142 | std::unique_ptr<Component> component = |
| 143 | Component::Create(GetTestDataPath("ext4_component"), keys_); |
| 144 | ASSERT_NE(nullptr, component); |
| 145 | |
| 146 | const base::FilePath copied_dir = temp_dir_.Append("dest"); |
| 147 | ASSERT_TRUE(base::CreateDirectory(copied_dir)); |
| 148 | ASSERT_TRUE(base::SetPosixFilePermissions(copied_dir, kComponentDirPerms)); |
| 149 | |
| 150 | ASSERT_TRUE(component->CopyTo(copied_dir)); |
| 151 | |
| 152 | std::unique_ptr<Component> copied_component = |
| 153 | Component::Create(copied_dir, keys_); |
| 154 | ASSERT_NE(nullptr, copied_component); |
| 155 | |
| 156 | const base::FilePath mount_dir = temp_dir_.Append("mount"); |
| 157 | ASSERT_TRUE(base::CreateDirectory(copied_dir)); |
| 158 | ASSERT_TRUE(base::SetPosixFilePermissions(copied_dir, kComponentDirPerms)); |
| 159 | |
| 160 | // Note: this fails to test the actual mounting process since it is just a |
| 161 | // mock here. The platform_ImageLoader autotest tests the real helper |
| 162 | // process running as a dbus service. |
Greg Kerr | 09f06de | 2018-02-16 15:32:07 -0800 | [diff] [blame] | 163 | auto helper_mock = std::make_unique<MockHelperProcessProxy>(); |
Xiaochu Liu | e61e1d6 | 2018-11-12 13:20:09 -0800 | [diff] [blame] | 164 | EXPECT_CALL(*helper_mock, SendMountCommand(_, _, FileSystem::kExt4, _)) |
Xiaochu Liu | c226434 | 2017-08-14 16:37:42 -0700 | [diff] [blame] | 165 | .Times(1); |
| 166 | ON_CALL(*helper_mock, SendMountCommand(_, _, _, _)) |
| 167 | .WillByDefault(testing::Return(true)); |
| 168 | ASSERT_TRUE(copied_component->Mount(helper_mock.get(), mount_dir)); |
| 169 | } |
| 170 | |
| 171 | TEST_F(ComponentTest, TestCopyAndMountComponentSquashfs) { |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 172 | std::unique_ptr<Component> component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 173 | Component::Create(GetTestComponentPath(), keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 174 | ASSERT_NE(nullptr, component); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 175 | |
| 176 | const base::FilePath copied_dir = temp_dir_.Append("dest"); |
| 177 | ASSERT_TRUE(base::CreateDirectory(copied_dir)); |
| 178 | ASSERT_TRUE(base::SetPosixFilePermissions(copied_dir, kComponentDirPerms)); |
| 179 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 180 | ASSERT_TRUE(component->CopyTo(copied_dir)); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 181 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 182 | std::unique_ptr<Component> copied_component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 183 | Component::Create(copied_dir, keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 184 | ASSERT_NE(nullptr, copied_component); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 185 | |
| 186 | const base::FilePath mount_dir = temp_dir_.Append("mount"); |
| 187 | ASSERT_TRUE(base::CreateDirectory(copied_dir)); |
| 188 | ASSERT_TRUE(base::SetPosixFilePermissions(copied_dir, kComponentDirPerms)); |
| 189 | |
Greg Kerr | 9944e24 | 2017-01-26 15:09:31 -0800 | [diff] [blame] | 190 | // Note: this fails to test the actual mounting process since it is just a |
| 191 | // mock here. The platform_ImageLoader autotest tests the real helper |
| 192 | // process running as a dbus service. |
Greg Kerr | 09f06de | 2018-02-16 15:32:07 -0800 | [diff] [blame] | 193 | auto helper_mock = std::make_unique<MockHelperProcessProxy>(); |
Xiaochu Liu | e61e1d6 | 2018-11-12 13:20:09 -0800 | [diff] [blame] | 194 | EXPECT_CALL(*helper_mock, SendMountCommand(_, _, FileSystem::kSquashFS, _)) |
Xiaochu Liu | c226434 | 2017-08-14 16:37:42 -0700 | [diff] [blame] | 195 | .Times(1); |
| 196 | ON_CALL(*helper_mock, SendMountCommand(_, _, _, _)) |
Greg Kerr | 9944e24 | 2017-01-26 15:09:31 -0800 | [diff] [blame] | 197 | .WillByDefault(testing::Return(true)); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 198 | ASSERT_TRUE(copied_component->Mount(helper_mock.get(), mount_dir)); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | TEST_F(ComponentTest, CheckFilesAfterCopy) { |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 202 | std::unique_ptr<Component> component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 203 | Component::Create(GetTestComponentPath(), keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 204 | ASSERT_NE(nullptr, component); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 205 | |
| 206 | const base::FilePath copied_dir = temp_dir_.Append("dest"); |
| 207 | ASSERT_TRUE(base::CreateDirectory(copied_dir)); |
| 208 | ASSERT_TRUE(base::SetPosixFilePermissions(copied_dir, kComponentDirPerms)); |
| 209 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 210 | ASSERT_TRUE(component->CopyTo(copied_dir)); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 211 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 212 | std::unique_ptr<Component> copied_component = |
Eric Caruso | 0b79bc8 | 2017-03-21 13:44:34 -0700 | [diff] [blame] | 213 | Component::Create(copied_dir, keys_); |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 214 | ASSERT_NE(nullptr, copied_component); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 215 | |
| 216 | // Check that all the files are present, except for the manifest.json which |
| 217 | // should be discarded. |
| 218 | std::list<std::string> original_files; |
| 219 | std::list<std::string> copied_files; |
| 220 | GetFilesInDir(GetTestComponentPath(), &original_files); |
| 221 | GetFilesInDir(copied_dir, &copied_files); |
| 222 | |
| 223 | EXPECT_THAT(original_files, |
| 224 | testing::UnorderedElementsAre( |
| 225 | "imageloader.json", "imageloader.sig.1", "manifest.json", |
| 226 | "table", "image.squash", "manifest.fingerprint")); |
| 227 | ASSERT_THAT(copied_files, |
| 228 | testing::UnorderedElementsAre( |
| 229 | "imageloader.json", "imageloader.sig.1", "table", |
| 230 | "image.squash", "manifest.fingerprint")); |
| 231 | EXPECT_TRUE( |
| 232 | CompareFileContents(GetTestComponentPath(), copied_dir, copied_files)); |
| 233 | } |
| 234 | |
| 235 | TEST_F(ComponentTest, IsValidFingerprintFile) { |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 236 | const std::string valid_manifest = |
| 237 | "1.3464353b1ed78574e05f3ffe84b52582572b2fe7202f3824a3761e54ace8bb1"; |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 238 | EXPECT_TRUE(Component::IsValidFingerprintFile(valid_manifest)); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 239 | |
| 240 | const std::string invalid_unicode_manifest = "Ё Ђ Ѓ Є Ѕ І Ї Ј Љ "; |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 241 | EXPECT_FALSE(Component::IsValidFingerprintFile(invalid_unicode_manifest)); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 242 | |
Eric Caruso | cbe1c5c | 2017-03-15 14:21:08 -0700 | [diff] [blame] | 243 | EXPECT_FALSE(Component::IsValidFingerprintFile("\x49\x34\x19-43.*+abc")); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | TEST_F(ComponentTest, InitComponentWithBadFiles) { |
| 247 | EXPECT_TRUE( |
| 248 | TestInitComponentWithCorruptFile("bad-component1", "imageloader.json")); |
| 249 | EXPECT_TRUE( |
| 250 | TestInitComponentWithCorruptFile("bad-component2", "imageloader.sig.1")); |
| 251 | } |
| 252 | |
| 253 | // Now corrupt the manifest of an already initialized component to verify that |
| 254 | // the copy operation fails. |
| 255 | TEST_F(ComponentTest, CopyWithBadFiles) { |
| 256 | EXPECT_TRUE(TestCopyWithCorruptFile("bad-component1", "image.squash")); |
| 257 | EXPECT_TRUE(TestCopyWithCorruptFile("bad-component2", "table")); |
| 258 | EXPECT_TRUE( |
| 259 | TestCopyWithCorruptFile("bad-component3", "manifest.fingerprint")); |
| 260 | } |
| 261 | |
| 262 | TEST_F(ComponentTest, CopyValidImage) { |
| 263 | const int image_size = 4096 * 4; |
| 264 | |
| 265 | base::FilePath image_path = temp_dir_.Append("image"); |
| 266 | std::vector<char> image(image_size, |
| 267 | 0xBB); // large enough to test streaming read. |
| 268 | ASSERT_EQ(image_size, |
| 269 | base::WriteFile(image_path, image.data(), image.size())); |
| 270 | |
| 271 | std::vector<uint8_t> hash(crypto::kSHA256Length); |
| 272 | |
| 273 | std::unique_ptr<crypto::SecureHash> sha256( |
| 274 | crypto::SecureHash::Create(crypto::SecureHash::SHA256)); |
| 275 | sha256->Update(image.data(), image.size()); |
| 276 | sha256->Finish(hash.data(), hash.size()); |
| 277 | |
Eric Caruso | 089bbff | 2017-03-21 11:34:15 -0700 | [diff] [blame] | 278 | Component component(GetTestComponentPath(), 1); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 279 | base::FilePath image_dest = temp_dir_.Append("image.copied"); |
| 280 | ASSERT_TRUE(component.CopyComponentFile(image_path, image_dest, hash)); |
| 281 | |
| 282 | // Check if the image file actually exists and has the correct contents. |
| 283 | std::string resulting_image; |
| 284 | ASSERT_TRUE(base::ReadFileToStringWithMaxSize(image_dest, &resulting_image, |
| 285 | image_size)); |
| 286 | |
Ben Chan | a92a9f0 | 2017-12-18 17:47:23 -0800 | [diff] [blame] | 287 | EXPECT_EQ(0, memcmp(image.data(), resulting_image.data(), image_size)); |
Greg Kerr | 019d59c | 2016-11-17 14:28:49 -0800 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | } // namespace imageloader |