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

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

Issue 9653022: Revert 125811 - Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 scoped_ptr<Feature> feature2(Feature::Parse(value.get())); 213 scoped_ptr<Feature> feature2(Feature::Parse(value.get()));
214 EXPECT_EQ(*(feature->extension_types()), *(feature2->extension_types())); 214 EXPECT_EQ(*(feature->extension_types()), *(feature2->extension_types()));
215 } 215 }
216 216
217 TEST(ExtensionFeatureTest, ParseContexts) { 217 TEST(ExtensionFeatureTest, ParseContexts) {
218 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 218 scoped_ptr<DictionaryValue> value(new DictionaryValue());
219 ListValue* contexts = new ListValue(); 219 ListValue* contexts = new ListValue();
220 contexts->Append(Value::CreateStringValue("privileged")); 220 contexts->Append(Value::CreateStringValue("privileged"));
221 contexts->Append(Value::CreateStringValue("unprivileged")); 221 contexts->Append(Value::CreateStringValue("unprivileged"));
222 contexts->Append(Value::CreateStringValue("content_script")); 222 contexts->Append(Value::CreateStringValue("content_script"));
223 contexts->Append(Value::CreateStringValue("web_page"));
224 value->Set("contexts", contexts); 223 value->Set("contexts", contexts);
225 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 224 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
226 EXPECT_EQ(4u, feature->contexts()->size()); 225 EXPECT_EQ(3u, feature->contexts()->size());
227 EXPECT_TRUE(feature->contexts()->count(Feature::PRIVILEGED_CONTEXT)); 226 EXPECT_TRUE(feature->contexts()->count(Feature::PRIVILEGED_CONTEXT));
228 EXPECT_TRUE(feature->contexts()->count(Feature::UNPRIVILEGED_CONTEXT)); 227 EXPECT_TRUE(feature->contexts()->count(Feature::UNPRIVILEGED_CONTEXT));
229 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT)); 228 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT));
230 EXPECT_TRUE(feature->contexts()->count(Feature::WEB_PAGE_CONTEXT));
231 229
232 value->SetString("contexts", "all"); 230 value->SetString("contexts", "all");
233 scoped_ptr<Feature> feature2(Feature::Parse(value.get())); 231 scoped_ptr<Feature> feature2(Feature::Parse(value.get()));
234 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts())); 232 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts()));
235 } 233 }
236 234
237 TEST(ExtensionFeatureTest, ParseLocation) { 235 TEST(ExtensionFeatureTest, ParseLocation) {
238 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 236 scoped_ptr<DictionaryValue> value(new DictionaryValue());
239 value->SetString("location", "component"); 237 value->SetString("location", "component");
240 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 238 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
241 EXPECT_EQ(Feature::COMPONENT_LOCATION, feature->location()); 239 EXPECT_EQ(Feature::COMPONENT_LOCATION, feature->location());
242 } 240 }
243 241
244 TEST(ExtensionFeatureTest, ParsePlatform) { 242 TEST(ExtensionFeatureTest, ParsePlatform) {
245 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 243 scoped_ptr<DictionaryValue> value(new DictionaryValue());
246 value->SetString("platform", "chromeos"); 244 value->SetString("platform", "chromeos");
247 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 245 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
248 EXPECT_EQ(Feature::CHROMEOS_PLATFORM, feature->platform()); 246 EXPECT_EQ(Feature::CHROMEOS_PLATFORM, feature->platform());
249 } 247 }
250 248
251 TEST(ExtensionFeatureTest, ManifestVersion) { 249 TEST(ExtensionFeatureTest, ManifestVersion) {
252 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 250 scoped_ptr<DictionaryValue> value(new DictionaryValue());
253 value->SetInteger("min_manifest_version", 1); 251 value->SetInteger("min_manifest_version", 1);
254 value->SetInteger("max_manifest_version", 5); 252 value->SetInteger("max_manifest_version", 5);
255 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 253 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
256 EXPECT_EQ(1, feature->min_manifest_version()); 254 EXPECT_EQ(1, feature->min_manifest_version());
257 EXPECT_EQ(5, feature->max_manifest_version()); 255 EXPECT_EQ(5, feature->max_manifest_version());
258 } 256 }
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