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

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

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // it contain no permissions dictionary. 119 // it contain no permissions dictionary.
120 std::string error; 120 std::string error;
121 std::unique_ptr<base::DictionaryValue> manifest( 121 std::unique_ptr<base::DictionaryValue> manifest(
122 LoadManifest("init_valid_platform_app.json", &error)); 122 LoadManifest("init_valid_platform_app.json", &error));
123 123
124 std::vector<std::unique_ptr<ManifestData>> manifests; 124 std::vector<std::unique_ptr<ManifestData>> manifests;
125 // Create each manifest. 125 // Create each manifest.
126 for (const char* api_name : kPlatformAppExperimentalApis) { 126 for (const char* api_name : kPlatformAppExperimentalApis) {
127 // DictionaryValue will take ownership of this ListValue. 127 // DictionaryValue will take ownership of this ListValue.
128 base::ListValue *permissions = new base::ListValue(); 128 base::ListValue *permissions = new base::ListValue();
129 permissions->Append(new base::StringValue("experimental")); 129 permissions->AppendString("experimental");
130 permissions->Append(new base::StringValue(api_name)); 130 permissions->AppendString(api_name);
131 manifest->Set("permissions", permissions); 131 manifest->Set("permissions", permissions);
132 manifests.push_back( 132 manifests.push_back(
133 base::WrapUnique(new ManifestData(manifest->CreateDeepCopy(), ""))); 133 base::WrapUnique(new ManifestData(manifest->CreateDeepCopy(), "")));
134 } 134 }
135 // First try to load without any flags. This should warn for every API. 135 // First try to load without any flags. This should warn for every API.
136 for (const std::unique_ptr<ManifestData>& manifest : manifests) { 136 for (const std::unique_ptr<ManifestData>& manifest : manifests) {
137 LoadAndExpectWarning( 137 LoadAndExpectWarning(
138 *manifest, 138 *manifest,
139 "'experimental' requires the 'experimental-extension-apis' " 139 "'experimental' requires the 'experimental-extension-apis' "
140 "command line switch to be enabled."); 140 "command line switch to be enabled.");
141 } 141 }
142 142
143 // Now try again with the experimental flag set. 143 // Now try again with the experimental flag set.
144 base::CommandLine::ForCurrentProcess()->AppendSwitch( 144 base::CommandLine::ForCurrentProcess()->AppendSwitch(
145 switches::kEnableExperimentalExtensionApis); 145 switches::kEnableExperimentalExtensionApis);
146 for (const std::unique_ptr<ManifestData>& manifest : manifests) 146 for (const std::unique_ptr<ManifestData>& manifest : manifests)
147 LoadAndExpectSuccess(*manifest); 147 LoadAndExpectSuccess(*manifest);
148 } 148 }
149 149
150 } // namespace extensions 150 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698