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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc

Issue 1880143002: Convert chrome/common to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
OLDNEW
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 <memory>
6
5 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" 7 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
6
7 #include "extensions/common/manifest_constants.h" 8 #include "extensions/common/manifest_constants.h"
9 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 11
11 using extensions::Extension; 12 using extensions::Extension;
12 13
13 namespace errors = extensions::manifest_errors; 14 namespace errors = extensions::manifest_errors;
14 15
15 TEST_F(ChromeManifestTest, ManifestVersionError) { 16 TEST_F(ChromeManifestTest, ManifestVersionError) {
16 scoped_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue()); 17 std::unique_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue());
17 manifest1->SetString("name", "Miles"); 18 manifest1->SetString("name", "Miles");
18 manifest1->SetString("version", "0.55"); 19 manifest1->SetString("version", "0.55");
19 20
20 scoped_ptr<base::DictionaryValue> manifest2(manifest1->DeepCopy()); 21 std::unique_ptr<base::DictionaryValue> manifest2(manifest1->DeepCopy());
21 manifest2->SetInteger("manifest_version", 1); 22 manifest2->SetInteger("manifest_version", 1);
22 23
23 scoped_ptr<base::DictionaryValue> manifest3(manifest1->DeepCopy()); 24 std::unique_ptr<base::DictionaryValue> manifest3(manifest1->DeepCopy());
24 manifest3->SetInteger("manifest_version", 2); 25 manifest3->SetInteger("manifest_version", 2);
25 26
26 struct { 27 struct {
27 const char* test_name; 28 const char* test_name;
28 bool require_modern_manifest_version; 29 bool require_modern_manifest_version;
29 base::DictionaryValue* manifest; 30 base::DictionaryValue* manifest;
30 bool expect_error; 31 bool expect_error;
31 } test_data[] = { 32 } test_data[] = {
32 {"require_modern_with_default", true, manifest1.get(), true}, 33 {"require_modern_with_default", true, manifest1.get(), true},
33 {"require_modern_with_v1", true, manifest2.get(), true}, 34 {"require_modern_with_v1", true, manifest2.get(), true},
(...skipping 10 matching lines...) Expand all
44 if (entry.expect_error) { 45 if (entry.expect_error) {
45 LoadAndExpectError(ManifestData(entry.manifest, entry.test_name), 46 LoadAndExpectError(ManifestData(entry.manifest, entry.test_name),
46 errors::kInvalidManifestVersionOld, 47 errors::kInvalidManifestVersionOld,
47 extensions::Manifest::UNPACKED, create_flags); 48 extensions::Manifest::UNPACKED, create_flags);
48 } else { 49 } else {
49 LoadAndExpectSuccess(ManifestData(entry.manifest, entry.test_name), 50 LoadAndExpectSuccess(ManifestData(entry.manifest, entry.test_name),
50 extensions::Manifest::UNPACKED, create_flags); 51 extensions::Manifest::UNPACKED, create_flags);
51 } 52 }
52 } 53 }
53 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698