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

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

Issue 2888073002: Remove raw DictionaryValue::Set in //chrome (Closed)
Patch Set: Fix Tests Created 3 years, 7 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 "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" 5 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
6 6
7 #include <utility>
8
9 #include "base/memory/ptr_util.h"
10 #include "base/values.h"
7 #include "extensions/common/manifest_constants.h" 11 #include "extensions/common/manifest_constants.h"
8 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
9 13
10 namespace keys = extensions::manifest_keys; 14 namespace keys = extensions::manifest_keys;
11 15
12 TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { 16 TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) {
13 base::DictionaryValue base_manifest; 17 base::DictionaryValue base_manifest;
14 { 18 {
15 base_manifest.SetString(keys::kName, "test"); 19 base_manifest.SetString(keys::kName, "test");
16 base_manifest.SetString(keys::kVersion, "0.1"); 20 base_manifest.SetString(keys::kVersion, "0.1");
17 base::ListValue* permissions = new base::ListValue(); 21 auto permissions = base::MakeUnique<base::ListValue>();
18 permissions->AppendString("storage"); 22 permissions->AppendString("storage");
19 base_manifest.Set(keys::kPermissions, permissions); 23 base_manifest.Set(keys::kPermissions, std::move(permissions));
20 } 24 }
21 25
22 std::string kManifestVersionError = 26 std::string kManifestVersionError =
23 "'storage' requires manifest version of at least 2."; 27 "'storage' requires manifest version of at least 2.";
24 28
25 // Extension with no manifest version cannot use storage API. 29 // Extension with no manifest version cannot use storage API.
26 { 30 {
27 ManifestData manifest(&base_manifest, "test"); 31 ManifestData manifest(&base_manifest, "test");
28 LoadAndExpectWarning(manifest, kManifestVersionError); 32 LoadAndExpectWarning(manifest, kManifestVersionError);
29 } 33 }
(...skipping 13 matching lines...) Expand all
43 base::DictionaryValue manifest_with_version; 47 base::DictionaryValue manifest_with_version;
44 manifest_with_version.SetInteger(keys::kManifestVersion, 2); 48 manifest_with_version.SetInteger(keys::kManifestVersion, 2);
45 manifest_with_version.MergeDictionary(&base_manifest); 49 manifest_with_version.MergeDictionary(&base_manifest);
46 50
47 ManifestData manifest(&manifest_with_version, "test"); 51 ManifestData manifest(&manifest_with_version, "test");
48 scoped_refptr<extensions::Extension> extension = 52 scoped_refptr<extensions::Extension> extension =
49 LoadAndExpectSuccess(manifest); 53 LoadAndExpectSuccess(manifest);
50 EXPECT_TRUE(extension->install_warnings().empty()); 54 EXPECT_TRUE(extension->install_warnings().empty());
51 } 55 }
52 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698