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

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: fix koz bool thing 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
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"));
223 value->Set("contexts", contexts); 224 value->Set("contexts", contexts);
224 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 225 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
225 EXPECT_EQ(3u, feature->contexts()->size()); 226 EXPECT_EQ(4u, feature->contexts()->size());
226 EXPECT_TRUE(feature->contexts()->count(Feature::PRIVILEGED_CONTEXT)); 227 EXPECT_TRUE(feature->contexts()->count(Feature::PRIVILEGED_CONTEXT));
227 EXPECT_TRUE(feature->contexts()->count(Feature::UNPRIVILEGED_CONTEXT)); 228 EXPECT_TRUE(feature->contexts()->count(Feature::UNPRIVILEGED_CONTEXT));
228 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT)); 229 EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT));
230 EXPECT_TRUE(feature->contexts()->count(Feature::WEB_PAGE_CONTEXT));
229 231
230 value->SetString("contexts", "all"); 232 value->SetString("contexts", "all");
231 scoped_ptr<Feature> feature2(Feature::Parse(value.get())); 233 scoped_ptr<Feature> feature2(Feature::Parse(value.get()));
232 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts())); 234 EXPECT_EQ(*(feature->contexts()), *(feature2->contexts()));
233 } 235 }
234 236
235 TEST(ExtensionFeatureTest, ParseLocation) { 237 TEST(ExtensionFeatureTest, ParseLocation) {
236 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 238 scoped_ptr<DictionaryValue> value(new DictionaryValue());
237 value->SetString("location", "component"); 239 value->SetString("location", "component");
238 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 240 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
239 EXPECT_EQ(Feature::COMPONENT_LOCATION, feature->location()); 241 EXPECT_EQ(Feature::COMPONENT_LOCATION, feature->location());
240 } 242 }
241 243
242 TEST(ExtensionFeatureTest, ParsePlatform) { 244 TEST(ExtensionFeatureTest, ParsePlatform) {
243 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 245 scoped_ptr<DictionaryValue> value(new DictionaryValue());
244 value->SetString("platform", "chromeos"); 246 value->SetString("platform", "chromeos");
245 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 247 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
246 EXPECT_EQ(Feature::CHROMEOS_PLATFORM, feature->platform()); 248 EXPECT_EQ(Feature::CHROMEOS_PLATFORM, feature->platform());
247 } 249 }
248 250
249 TEST(ExtensionFeatureTest, ManifestVersion) { 251 TEST(ExtensionFeatureTest, ManifestVersion) {
250 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 252 scoped_ptr<DictionaryValue> value(new DictionaryValue());
251 value->SetInteger("min_manifest_version", 1); 253 value->SetInteger("min_manifest_version", 1);
252 value->SetInteger("max_manifest_version", 5); 254 value->SetInteger("max_manifest_version", 5);
253 scoped_ptr<Feature> feature(Feature::Parse(value.get())); 255 scoped_ptr<Feature> feature(Feature::Parse(value.get()));
254 EXPECT_EQ(1, feature->min_manifest_version()); 256 EXPECT_EQ(1, feature->min_manifest_version());
255 EXPECT_EQ(5, feature->max_manifest_version()); 257 EXPECT_EQ(5, feature->max_manifest_version());
256 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698