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

Unified Diff: chrome/common/extensions/manifest_tests/extension_manifest_test.cc

Issue 178253007: Parse manifest file with app.service_worker.script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved test utils out of base Created 6 years, 10 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_tests/extension_manifest_test.cc
diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
index 845bf0a06a58b7d6f9040060093b93447d73602e..158efbfe65505f78bf29f43a6f0a84f4354d4200 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
@@ -11,6 +11,7 @@
#include "base/values.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_l10n_util.h"
+#include "extensions/common/test_util.h"
#include "ui/base/l10n/l10n_util.h"
using extensions::Extension;
@@ -67,6 +68,12 @@ ExtensionManifestTest::Manifest::Manifest(base::DictionaryValue* manifest,
CHECK(manifest_) << "Manifest NULL";
}
+ExtensionManifestTest::Manifest::Manifest(
+ scoped_ptr<base::DictionaryValue> manifest)
+ : manifest_(manifest.get()), manifest_holder_(manifest.Pass()) {
+ CHECK(manifest_) << "Manifest NULL";
+}
+
ExtensionManifestTest::Manifest::Manifest(const Manifest& m) {
NOTREACHED();
}
@@ -134,6 +141,13 @@ scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectSuccess(
return LoadAndExpectSuccess(Manifest(manifest_name), location, flags);
}
+scoped_refptr<Extension> ExtensionManifestTest::LoadFromStringAndExpectSuccess(
+ char const* manifest_json) {
+ return LoadAndExpectSuccess(
+ Manifest(extensions::test_util::ParseJsonDictionaryWithSingleQuotes(
+ manifest_json)));
+}
+
scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectWarning(
const Manifest& manifest,
const std::string& expected_warning,
@@ -191,6 +205,15 @@ void ExtensionManifestTest::LoadAndExpectError(
Manifest(manifest_name), expected_error, location, flags);
}
+void ExtensionManifestTest::LoadFromStringAndExpectError(
+ char const* manifest_json,
+ const std::string& expected_error) {
+ return LoadAndExpectError(
+ Manifest(extensions::test_util::ParseJsonDictionaryWithSingleQuotes(
+ manifest_json)),
+ expected_error);
+}
+
void ExtensionManifestTest::AddPattern(extensions::URLPatternSet* extent,
const std::string& pattern) {
int schemes = URLPattern::SCHEME_ALL;

Powered by Google App Engine
This is Rietveld 408576698