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

Unified Diff: chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc

Issue 562273006: Move the last extensions/common unit tests to extensions_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest2
Patch Set: (file-tests) review comments Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
diff --git a/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc b/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
index 8b831dadbd19e6a7bc8688c7e342738825aab938..5494feb7ded18df173f0c28525c8713126a05ce7 100644
--- a/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
+++ b/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
@@ -3,11 +3,15 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/files/file_path.h"
+#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
+#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
+#include "extensions/common/file_util.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/switches.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -83,4 +87,21 @@ TEST_F(ContentScriptsManifestTest, ContentScriptIds) {
EXPECT_EQ(id + 1, user_scripts2[0].id());
}
+TEST_F(ContentScriptsManifestTest, FailLoadingNonUTF8Scripts) {
+ base::FilePath install_dir;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &install_dir));
+ install_dir = install_dir.AppendASCII("extensions")
+ .AppendASCII("bad")
+ .AppendASCII("bad_encoding");
+
+ std::string error;
+ scoped_refptr<Extension> extension(file_util::LoadExtension(
+ install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
+ ASSERT_TRUE(extension.get() == NULL);
+ ASSERT_STREQ(
+ "Could not load file 'bad_encoding.js' for content script. "
+ "It isn't UTF-8 encoded.",
+ error.c_str());
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698