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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "testing/gmock/include/gmock/gmock.h"
9
10 using extensions::Extension;
11
12 namespace errors = extension_manifest_errors;
13
14 TEST_F(ExtensionManifestTest, ManifestVersionWarning) {
15 scoped_ptr<DictionaryValue> manifest1(new DictionaryValue());
16 manifest1->SetString("name", "Miles");
17 manifest1->SetString("version", "0.55");
18
19 scoped_ptr<DictionaryValue> manifest2(manifest1->DeepCopy());
20 manifest2->SetInteger("manifest_version", 1);
21
22 scoped_ptr<DictionaryValue> manifest3(manifest1->DeepCopy());
23 manifest3->SetInteger("manifest_version", 2);
24
25 struct {
26 const char* test_name;
27 DictionaryValue* manifest;
28 bool expect_warning;
29 } test_data[] = {
30 { "default_manifest_version", manifest1.get(), true },
31 { "manifest_version_1", manifest2.get(), true },
32 { "manifest_version_2", manifest3.get(), false }
33 };
34
35 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) {
36 scoped_refptr<Extension> extension(
37 LoadAndExpectSuccess(Manifest(test_data[i].manifest,
38 test_data[i].test_name),
39 Extension::LOAD));
40 if (test_data[i].expect_warning) {
41 EXPECT_THAT(
42 extension->install_warnings(),
43 testing::Contains(
44 testing::Field(
45 &Extension::InstallWarning::message,
46 testing::HasSubstr(
47 "Manifest version 1 will be unsupported soon."))))
48 << test_data[i].test_name;
49 } else {
50 EXPECT_THAT(
51 extension->install_warnings(),
52 testing::Not(
53 testing::Contains(
54 testing::Field(
55 &Extension::InstallWarning::message,
56 testing::HasSubstr(
57 "Manifest version 1 will be unsupported soon.")))))
58 << test_data[i].test_name;
59 }
60 }
61 }
OLDNEW
« 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