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 <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 Loading... |
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 |
OLD | NEW |