| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 6 | 6 |
| 7 #include "extensions/common/manifest_constants.h" | 7 #include "extensions/common/manifest_constants.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 | 10 |
| 11 using extensions::Extension; | 11 using extensions::Extension; |
| 12 | 12 |
| 13 namespace errors = extensions::manifest_errors; | 13 namespace errors = extensions::manifest_errors; |
| 14 | 14 |
| 15 TEST_F(ChromeManifestTest, ManifestVersionError) { | 15 TEST_F(ExtensionManifestTest, ManifestVersionError) { |
| 16 scoped_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue()); | 16 scoped_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue()); |
| 17 manifest1->SetString("name", "Miles"); | 17 manifest1->SetString("name", "Miles"); |
| 18 manifest1->SetString("version", "0.55"); | 18 manifest1->SetString("version", "0.55"); |
| 19 | 19 |
| 20 scoped_ptr<base::DictionaryValue> manifest2(manifest1->DeepCopy()); | 20 scoped_ptr<base::DictionaryValue> manifest2(manifest1->DeepCopy()); |
| 21 manifest2->SetInteger("manifest_version", 1); | 21 manifest2->SetInteger("manifest_version", 1); |
| 22 | 22 |
| 23 scoped_ptr<base::DictionaryValue> manifest3(manifest1->DeepCopy()); | 23 scoped_ptr<base::DictionaryValue> manifest3(manifest1->DeepCopy()); |
| 24 manifest3->SetInteger("manifest_version", 2); | 24 manifest3->SetInteger("manifest_version", 2); |
| 25 | 25 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 { "dont_require_modern_with_v1", false, manifest2.get(), false }, | 36 { "dont_require_modern_with_v1", false, manifest2.get(), false }, |
| 37 { "dont_require_modern_with_v2", false, manifest3.get(), false }, | 37 { "dont_require_modern_with_v2", false, manifest3.get(), false }, |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { | 40 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { |
| 41 int create_flags = Extension::NO_FLAGS; | 41 int create_flags = Extension::NO_FLAGS; |
| 42 if (test_data[i].require_modern_manifest_version) | 42 if (test_data[i].require_modern_manifest_version) |
| 43 create_flags |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; | 43 create_flags |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; |
| 44 if (test_data[i].expect_error) { | 44 if (test_data[i].expect_error) { |
| 45 LoadAndExpectError( | 45 LoadAndExpectError( |
| 46 ManifestData(test_data[i].manifest, | 46 Manifest(test_data[i].manifest, |
| 47 test_data[i].test_name), | 47 test_data[i].test_name), |
| 48 errors::kInvalidManifestVersionOld, | 48 errors::kInvalidManifestVersionOld, |
| 49 extensions::Manifest::UNPACKED, | 49 extensions::Manifest::UNPACKED, |
| 50 create_flags); | 50 create_flags); |
| 51 } else { | 51 } else { |
| 52 LoadAndExpectSuccess(ManifestData(test_data[i].manifest, | 52 LoadAndExpectSuccess(Manifest(test_data[i].manifest, |
| 53 test_data[i].test_name), | 53 test_data[i].test_name), |
| 54 extensions::Manifest::UNPACKED, | 54 extensions::Manifest::UNPACKED, |
| 55 create_flags); | 55 create_flags); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 } | 58 } |
| OLD | NEW |