| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "extensions/common/error_utils.h" |
| 7 #include "extensions/common/extension.h" |
| 8 #include "extensions/common/file_util.h" |
| 9 #include "extensions/common/manifest_constants.h" |
| 10 #include "extensions/common/value_builder.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 namespace extensions { |
| 14 |
| 15 TEST(ChromeURLOverridesHandlerTest, TestFileMissing) { |
| 16 DictionaryBuilder manifest; |
| 17 manifest.Set("name", "ntp override"); |
| 18 manifest.Set("version", "0.1"); |
| 19 manifest.Set("manifest_version", 2); |
| 20 manifest.Set("description", "description"); |
| 21 manifest.Set("chrome_url_overrides", |
| 22 DictionaryBuilder().Set("newtab", "newtab.html").Build()); |
| 23 std::unique_ptr<base::DictionaryValue> manifest_value = manifest.Build(); |
| 24 std::string error; |
| 25 std::vector<InstallWarning> warnings; |
| 26 base::ScopedTempDir dir; |
| 27 ASSERT_TRUE(dir.CreateUniqueTempDir()); |
| 28 scoped_refptr<Extension> extension = |
| 29 Extension::Create(dir.path(), Manifest::INTERNAL, *manifest_value, |
| 30 Extension::NO_FLAGS, std::string(), &error); |
| 31 ASSERT_TRUE(extension); |
| 32 EXPECT_FALSE( |
| 33 file_util::ValidateExtension(extension.get(), &error, &warnings)); |
| 34 EXPECT_EQ(ErrorUtils::FormatErrorMessage(manifest_errors::kFileNotFound, |
| 35 "newtab.html"), |
| 36 error); |
| 37 } |
| 38 |
| 39 } // namespace extensions |
| OLD | NEW |