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

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: destructor added 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..ac3ef220d1410dd991b71e86b79b2d251f5c9cea 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
@@ -4,9 +4,12 @@
#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
+#include <algorithm>
+
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/json/json_file_value_serializer.h"
+#include "base/json/json_string_value_serializer.h"
#include "base/path_service.h"
#include "base/values.h"
#include "chrome/common/chrome_paths.h"
@@ -88,6 +91,19 @@ base::DictionaryValue* ExtensionManifestTest::Manifest::GetManifest(
return manifest_;
}
+ExtensionManifestTest::ManifestFromString::ManifestFromString(
+ const char* manifest_as_string_with_single_quotes)
+ : Manifest("") {
+ std::string manifest_string = manifest_as_string_with_single_quotes;
Jeffrey Yasskin 2014/02/28 01:54:37 If you're going to copy a string anyway, just take
scheib 2014/03/03 19:54:00 Done.
+ std::replace(manifest_string.begin(), manifest_string.end(), '\'', '"');
+ JSONStringValueSerializer serializer(manifest_string);
Jeffrey Yasskin 2014/02/28 01:54:37 Let's use one of the existing parse-json-for-test
scheib 2014/03/03 19:54:00 Moved this functionality to base::test::ParseJsonD
+ parsed_manifest_holder_.reset(serializer.Deserialize(NULL, NULL));
+ CHECK(parsed_manifest_holder_);
+ CHECK(parsed_manifest_holder_->GetAsDictionary(&manifest_));
+}
+
+ExtensionManifestTest::ManifestFromString::~ManifestFromString() {}
+
char const* ExtensionManifestTest::test_data_dir() {
return "manifest_tests";
}

Powered by Google App Engine
This is Rietveld 408576698