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

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

Issue 10536084: Add a warning when developing an extension that uses old manifest version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blonk Created 8 years, 6 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_manifests_manifest_version_unittest.cc
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..33895e9bdc8c7b37933ba8af4ac0b9513911877c
--- /dev/null
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+using extensions::Extension;
+
+namespace errors = extension_manifest_errors;
+
+TEST_F(ExtensionManifestTest, ManifestVersionWarning) {
+ scoped_ptr<DictionaryValue> manifest1(new DictionaryValue());
+ manifest1->SetString("name", "Miles");
+ manifest1->SetString("version", "0.55");
+
+ scoped_ptr<DictionaryValue> manifest2(manifest1->DeepCopy());
+ manifest2->SetInteger("manifest_version", 1);
+
+ scoped_ptr<DictionaryValue> manifest3(manifest1->DeepCopy());
+ manifest3->SetInteger("manifest_version", 2);
+
+ struct {
+ const char* test_name;
+ DictionaryValue* manifest;
+ bool expect_warning;
+ } test_data[] = {
+ { "default_manifest_version", manifest1.get(), true },
+ { "manifest_version_1", manifest2.get(), true },
+ { "manifest_version_2", manifest3.get(), false }
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) {
+ scoped_refptr<Extension> extension(
+ LoadAndExpectSuccess(Manifest(test_data[i].manifest,
+ test_data[i].test_name),
+ Extension::LOAD));
+ if (test_data[i].expect_warning) {
+ EXPECT_THAT(
+ extension->install_warnings(),
+ testing::Contains(
+ testing::Field(
+ &Extension::InstallWarning::message,
+ testing::HasSubstr(
+ "Manifest version 1 will be unsupported soon."))))
+ << test_data[i].test_name;
+ } else {
+ EXPECT_THAT(
+ extension->install_warnings(),
+ testing::Not(
+ testing::Contains(
+ testing::Field(
+ &Extension::InstallWarning::message,
+ testing::HasSubstr(
+ "Manifest version 1 will be unsupported soon.")))))
+ << test_data[i].test_name;
+ }
+ }
+}
« no previous file with comments | « chrome/common/extensions/manifest_tests/extension_manifest_test.cc ('k') | chrome/common/extensions/manifest_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698