Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/common/extensions/chrome_manifest_url_handlers_unittest.cc

Issue 1977303004: [Extensions] Validate file existence for chrome url overrides (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « chrome/common/extensions/chrome_manifest_url_handlers.cc ('k') | extensions/common/manifest_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698