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

Side by Side Diff: chrome/common/extensions/api/common_extension_api_unittest.cc

Issue 1321313004: Remove use of JSONReader::DeprecatedRead from common_extension_api_unittest.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/common/extension_api.h" 5 #include "extensions/common/extension_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path); 163 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path);
164 api_features_path = api_features_path.AppendASCII("extensions") 164 api_features_path = api_features_path.AppendASCII("extensions")
165 .AppendASCII("extension_api_unittest") 165 .AppendASCII("extension_api_unittest")
166 .AppendASCII("api_features.json"); 166 .AppendASCII("api_features.json");
167 167
168 std::string api_features_str; 168 std::string api_features_str;
169 ASSERT_TRUE(base::ReadFileToString( 169 ASSERT_TRUE(base::ReadFileToString(
170 api_features_path, &api_features_str)) << "api_features.json"; 170 api_features_path, &api_features_str)) << "api_features.json";
171 171
172 scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>( 172 scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>(
173 base::JSONReader::DeprecatedRead(api_features_str))); 173 base::JSONReader::Read(api_features_str).release()));
174 BaseFeatureProvider api_feature_provider(*value, CreateAPIFeature); 174 BaseFeatureProvider api_feature_provider(*value, CreateAPIFeature);
175 175
176 for (size_t i = 0; i < arraysize(test_data); ++i) { 176 for (size_t i = 0; i < arraysize(test_data); ++i) {
177 ExtensionAPI api; 177 ExtensionAPI api;
178 api.RegisterDependencyProvider("api", &api_feature_provider); 178 api.RegisterDependencyProvider("api", &api_feature_provider);
179 for (base::DictionaryValue::Iterator iter(*value); !iter.IsAtEnd(); 179 for (base::DictionaryValue::Iterator iter(*value); !iter.IsAtEnd();
180 iter.Advance()) { 180 iter.Advance()) {
181 if (iter.key().find(".") == std::string::npos) 181 if (iter.key().find(".") == std::string::npos)
182 api.RegisterSchemaResource(iter.key(), 0); 182 api.RegisterSchemaResource(iter.key(), 0);
183 } 183 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path); 243 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path);
244 api_features_path = api_features_path.AppendASCII("extensions") 244 api_features_path = api_features_path.AppendASCII("extensions")
245 .AppendASCII("extension_api_unittest") 245 .AppendASCII("extension_api_unittest")
246 .AppendASCII("api_features.json"); 246 .AppendASCII("api_features.json");
247 247
248 std::string api_features_str; 248 std::string api_features_str;
249 ASSERT_TRUE(base::ReadFileToString( 249 ASSERT_TRUE(base::ReadFileToString(
250 api_features_path, &api_features_str)) << "api_features.json"; 250 api_features_path, &api_features_str)) << "api_features.json";
251 251
252 scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>( 252 scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>(
253 base::JSONReader::DeprecatedRead(api_features_str))); 253 base::JSONReader::Read(api_features_str).release()));
254 BaseFeatureProvider api_feature_provider(*value, CreateAPIFeature); 254 BaseFeatureProvider api_feature_provider(*value, CreateAPIFeature);
255 255
256 for (size_t i = 0; i < arraysize(test_data); ++i) { 256 for (size_t i = 0; i < arraysize(test_data); ++i) {
257 ExtensionAPI api; 257 ExtensionAPI api;
258 api.RegisterDependencyProvider("api", &api_feature_provider); 258 api.RegisterDependencyProvider("api", &api_feature_provider);
259 for (base::DictionaryValue::Iterator iter(*value); !iter.IsAtEnd(); 259 for (base::DictionaryValue::Iterator iter(*value); !iter.IsAtEnd();
260 iter.Advance()) { 260 iter.Advance()) {
261 if (iter.key().find(".") == std::string::npos) 261 if (iter.key().find(".") == std::string::npos)
262 api.RegisterSchemaResource(iter.key(), 0); 262 api.RegisterSchemaResource(iter.key(), 0);
263 } 263 }
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 extension.get(), 829 extension.get(),
830 Feature::BLESSED_EXTENSION_CONTEXT, 830 Feature::BLESSED_EXTENSION_CONTEXT,
831 GURL()).is_available()); 831 GURL()).is_available());
832 EXPECT_FALSE(extension_api->IsAvailable("pageAction", 832 EXPECT_FALSE(extension_api->IsAvailable("pageAction",
833 extension.get(), 833 extension.get(),
834 Feature::BLESSED_EXTENSION_CONTEXT, 834 Feature::BLESSED_EXTENSION_CONTEXT,
835 GURL()).is_available()); 835 GURL()).is_available());
836 } 836 }
837 837
838 } // namespace extensions 838 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698