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

Side by Side Diff: chrome/common/extensions/feature_unittest.cc

Issue 9460002: Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make test extension ID tests pass Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/feature.cc ('k') | chrome/renderer/extensions/app_bindings.cc » ('j') | 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 "chrome/common/extensions/feature.h" 5 #include "chrome/common/extensions/feature.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 using extensions::Feature; 9 using extensions::Feature;
10 10
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 scoped_ptr<Feature> feature2(Feature::Parse(value.get())); 229 scoped_ptr<Feature> feature2(Feature::Parse(value.get()));
230 EXPECT_EQ(*(feature->extension_types()), *(feature2->extension_types())); 230 EXPECT_EQ(*(feature->extension_types()), *(feature2->extension_types()));
231 } 231 }
232 232
233 TEST(ExtensionFeatureTest, ParseContexts) { 233 TEST(ExtensionFeatureTest, ParseContexts) {
234 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 234 scoped_ptr<DictionaryValue> value(new DictionaryValue());
235 ListValue* contexts = new ListValue(); 235 ListValue* contexts = new ListValue();
236 contexts->Append(Value::CreateStringValue("privileged")); 236 contexts->Append(Value::CreateStringValue("privileged"));
237 contexts->Append(Value::CreateStringValue("unprivileged")); 237 contexts->Append(Value::CreateStringValue("unprivileged"));
238 contexts->Append(Value::CreateStringValue("content_script")); 238 contexts->Append(Value::CreateStringValue("content_script"));
239 contexts->Append(Value::CreateStringValue("web_page"));
239 value->Set("contexts", contexts); 240 value->Set("contexts", contexts);
240 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 241 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
241 EXPECT_EQ(3u, feature->contexts()->size()); 242 EXPECT_EQ(4u, feature->contexts()->size());
242 EXPECT_TRUE(feature->contexts()->count(Feature::PRIVILEGED_CONTEXT)); 243 EXPECT_TRUE(feature->contexts()->count(Feature::PRIVILEGED_CONTEXT));
243 EXPECT_TRUE(feature->contexts()->count(Feature::UNPRIVILEGED_CONTEXT)); 244 EXPECT_TRUE(feature->contexts()->count(Feature::UNPRIVILEGED_CONTEXT));
244 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT)); 245 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT));
246 EXPECT_TRUE(feature->contexts()->count(Feature::WEB_PAGE_CONTEXT));
245 247
246 value->SetString("contexts", "all"); 248 value->SetString("contexts", "all");
247 scoped_ptr<Feature> feature2(Feature::Parse(value.get())); 249 scoped_ptr<Feature> feature2(Feature::Parse(value.get()));
248 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts())); 250 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts()));
249 } 251 }
250 252
251 TEST(ExtensionFeatureTest, ParseLocation) { 253 TEST(ExtensionFeatureTest, ParseLocation) {
252 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 254 scoped_ptr<DictionaryValue> value(new DictionaryValue());
253 value->SetString("location", "component"); 255 value->SetString("location", "component");
254 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 256 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
255 EXPECT_EQ(Feature::COMPONENT_LOCATION, feature->location()); 257 EXPECT_EQ(Feature::COMPONENT_LOCATION, feature->location());
256 } 258 }
257 259
258 TEST(ExtensionFeatureTest, ParsePlatform) { 260 TEST(ExtensionFeatureTest, ParsePlatform) {
259 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 261 scoped_ptr<DictionaryValue> value(new DictionaryValue());
260 value->SetString("platform", "chromeos"); 262 value->SetString("platform", "chromeos");
261 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 263 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
262 EXPECT_EQ(Feature::CHROMEOS_PLATFORM, feature->platform()); 264 EXPECT_EQ(Feature::CHROMEOS_PLATFORM, feature->platform());
263 } 265 }
264 266
265 TEST(ExtensionFeatureTest, ManifestVersion) { 267 TEST(ExtensionFeatureTest, ManifestVersion) {
266 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 268 scoped_ptr<DictionaryValue> value(new DictionaryValue());
267 value->SetInteger("min_manifest_version", 1); 269 value->SetInteger("min_manifest_version", 1);
268 value->SetInteger("max_manifest_version", 5); 270 value->SetInteger("max_manifest_version", 5);
269 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 271 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
270 EXPECT_EQ(1, feature->min_manifest_version()); 272 EXPECT_EQ(1, feature->min_manifest_version());
271 EXPECT_EQ(5, feature->max_manifest_version()); 273 EXPECT_EQ(5, feature->max_manifest_version());
272 } 274 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/feature.cc ('k') | chrome/renderer/extensions/app_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698