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

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

Issue 2341693002: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Change std::string() back to "" to fix compile Created 4 years, 3 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 std::vector<std::unique_ptr<ManifestData>> manifests; 125 std::vector<std::unique_ptr<ManifestData>> manifests;
126 // Create each manifest. 126 // Create each manifest.
127 for (const char* api_name : kPlatformAppExperimentalApis) { 127 for (const char* api_name : kPlatformAppExperimentalApis) {
128 // DictionaryValue will take ownership of this ListValue. 128 // DictionaryValue will take ownership of this ListValue.
129 base::ListValue *permissions = new base::ListValue(); 129 base::ListValue *permissions = new base::ListValue();
130 permissions->AppendString("experimental"); 130 permissions->AppendString("experimental");
131 permissions->AppendString(api_name); 131 permissions->AppendString(api_name);
132 manifest->Set("permissions", permissions); 132 manifest->Set("permissions", permissions);
133 manifests.push_back( 133 manifests.push_back(
134 base::WrapUnique(new ManifestData(manifest->CreateDeepCopy(), ""))); 134 base::MakeUnique<ManifestData>(manifest->CreateDeepCopy(), ""));
135 } 135 }
136 // First try to load without any flags. This should warn for every API. 136 // First try to load without any flags. This should warn for every API.
137 for (const std::unique_ptr<ManifestData>& manifest : manifests) { 137 for (const std::unique_ptr<ManifestData>& manifest : manifests) {
138 LoadAndExpectWarning( 138 LoadAndExpectWarning(
139 *manifest, 139 *manifest,
140 "'experimental' requires the 'experimental-extension-apis' " 140 "'experimental' requires the 'experimental-extension-apis' "
141 "command line switch to be enabled."); 141 "command line switch to be enabled.");
142 } 142 }
143 143
144 // Now try again with the experimental flag set. 144 // Now try again with the experimental flag set.
145 base::CommandLine::ForCurrentProcess()->AppendSwitch( 145 base::CommandLine::ForCurrentProcess()->AppendSwitch(
146 switches::kEnableExperimentalExtensionApis); 146 switches::kEnableExperimentalExtensionApis);
147 for (const std::unique_ptr<ManifestData>& manifest : manifests) 147 for (const std::unique_ptr<ManifestData>& manifest : manifests)
148 LoadAndExpectSuccess(*manifest); 148 LoadAndExpectSuccess(*manifest);
149 } 149 }
150 150
151 } // namespace extensions 151 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc ('k') | chrome/installer/util/beacons.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698