| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 EXPECT_TRUE(result->mismatch_paths.empty()); | 214 EXPECT_TRUE(result->mismatch_paths.empty()); |
| 215 | 215 |
| 216 // Make sure the verified_contents.json file was written into the extension's | 216 // Make sure the verified_contents.json file was written into the extension's |
| 217 // install dir. | 217 // install dir. |
| 218 EXPECT_TRUE( | 218 EXPECT_TRUE( |
| 219 base::PathExists(file_util::GetVerifiedContentsPath(extension->path()))); | 219 base::PathExists(file_util::GetVerifiedContentsPath(extension->path()))); |
| 220 } | 220 } |
| 221 | 221 |
| 222 // Similar to MissingVerifiedContents, but tests the case where the extension | 222 // Similar to MissingVerifiedContents, but tests the case where the extension |
| 223 // actually has corruption. | 223 // actually has corruption. |
| 224 TEST_F(ContentHashFetcherTest, MissingVerifiedContentsAndCorrupt) { | 224 // Flaky on Linux and ChromeOS. crbug.com/ |
| 225 #if defined(OS_LINUX) || defined(OS_CHROMEOS) |
| 226 #define MAYBE_MissingVerifiedContentsAndCorrupt \ |
| 227 DISABLED_MissingVerifiedContentsAndCorrupt |
| 228 #else |
| 229 #define MAYBE_MissingVerifiedContentsAndCorrupt \ |
| 230 MissingVerifiedContentsAndCorrupt |
| 231 #endif |
| 232 TEST_F(ContentHashFetcherTest, MAYBE_MissingVerifiedContentsAndCorrupt) { |
| 225 base::FilePath test_dir_base = | 233 base::FilePath test_dir_base = |
| 226 GetTestPath(base::FilePath()).AppendASCII("missing_verified_contents"); | 234 GetTestPath(base::FilePath()).AppendASCII("missing_verified_contents"); |
| 227 scoped_refptr<Extension> extension = | 235 scoped_refptr<Extension> extension = |
| 228 UnzipToTempDirAndLoad(test_dir_base.AppendASCII("source.zip")); | 236 UnzipToTempDirAndLoad(test_dir_base.AppendASCII("source.zip")); |
| 229 | 237 |
| 230 // Tamper with a file in the extension. | 238 // Tamper with a file in the extension. |
| 231 base::FilePath script_path = extension->path().AppendASCII("script.js"); | 239 base::FilePath script_path = extension->path().AppendASCII("script.js"); |
| 232 std::string addition = "//hello world"; | 240 std::string addition = "//hello world"; |
| 233 ASSERT_TRUE( | 241 ASSERT_TRUE( |
| 234 base::AppendToFile(script_path, addition.c_str(), addition.size())); | 242 base::AppendToFile(script_path, addition.c_str(), addition.size())); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 252 EXPECT_TRUE( | 260 EXPECT_TRUE( |
| 253 base::ContainsKey(result->mismatch_paths, script_path.BaseName())); | 261 base::ContainsKey(result->mismatch_paths, script_path.BaseName())); |
| 254 | 262 |
| 255 // Make sure the verified_contents.json file was written into the extension's | 263 // Make sure the verified_contents.json file was written into the extension's |
| 256 // install dir. | 264 // install dir. |
| 257 EXPECT_TRUE( | 265 EXPECT_TRUE( |
| 258 base::PathExists(file_util::GetVerifiedContentsPath(extension->path()))); | 266 base::PathExists(file_util::GetVerifiedContentsPath(extension->path()))); |
| 259 } | 267 } |
| 260 | 268 |
| 261 } // namespace extensions | 269 } // namespace extensions |
| OLD | NEW |