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

Side by Side Diff: chrome/common/extensions/features/simple_feature_provider_unittest.cc

Issue 10909239: Rename PACKAGED_APP references to LEGACY_PACKAGED_APP (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments Created 8 years, 2 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
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/features/simple_feature_provider.h" 5 #include "chrome/common/extensions/features/simple_feature_provider.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 using extensions::Extension; 9 using extensions::Extension;
10 using extensions::Feature; 10 using extensions::Feature;
11 using extensions::SimpleFeatureProvider; 11 using extensions::SimpleFeatureProvider;
12 12
13 TEST(SimpleFeatureProvider, ManifestFeatures) { 13 TEST(SimpleFeatureProvider, ManifestFeatures) {
14 SimpleFeatureProvider* provider = 14 SimpleFeatureProvider* provider =
15 SimpleFeatureProvider::GetManifestFeatures(); 15 SimpleFeatureProvider::GetManifestFeatures();
16 Feature* feature = provider->GetFeature("description"); 16 Feature* feature = provider->GetFeature("description");
17 ASSERT_TRUE(feature); 17 ASSERT_TRUE(feature);
18 EXPECT_EQ(5u, feature->extension_types()->size()); 18 EXPECT_EQ(5u, feature->extension_types()->size());
19 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION)); 19 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION));
20 EXPECT_EQ(1u, 20 EXPECT_EQ(1u,
21 feature->extension_types()->count(Extension::TYPE_PACKAGED_APP)); 21 feature->extension_types()->count(Extension::TYPE_LEGACY_PACKAGED_APP));
22 EXPECT_EQ(1u, 22 EXPECT_EQ(1u,
23 feature->extension_types()->count(Extension::TYPE_PLATFORM_APP)); 23 feature->extension_types()->count(Extension::TYPE_PLATFORM_APP));
24 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_HOSTED_APP)); 24 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_HOSTED_APP));
25 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_THEME)); 25 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_THEME));
26 26
27 DictionaryValue manifest; 27 DictionaryValue manifest;
28 manifest.SetString("name", "test extension"); 28 manifest.SetString("name", "test extension");
29 manifest.SetString("version", "1"); 29 manifest.SetString("version", "1");
30 manifest.SetString("description", "hello there"); 30 manifest.SetString("description", "hello there");
31 31
(...skipping 18 matching lines...) Expand all
50 } 50 }
51 51
52 TEST(SimpleFeatureProvider, PermissionFeatures) { 52 TEST(SimpleFeatureProvider, PermissionFeatures) {
53 SimpleFeatureProvider* provider = 53 SimpleFeatureProvider* provider =
54 SimpleFeatureProvider::GetPermissionFeatures(); 54 SimpleFeatureProvider::GetPermissionFeatures();
55 Feature* feature = provider->GetFeature("contextMenus"); 55 Feature* feature = provider->GetFeature("contextMenus");
56 ASSERT_TRUE(feature); 56 ASSERT_TRUE(feature);
57 EXPECT_EQ(3u, feature->extension_types()->size()); 57 EXPECT_EQ(3u, feature->extension_types()->size());
58 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION)); 58 EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION));
59 EXPECT_EQ(1u, 59 EXPECT_EQ(1u,
60 feature->extension_types()->count(Extension::TYPE_PACKAGED_APP)); 60 feature->extension_types()->count(Extension::TYPE_LEGACY_PACKAGED_APP));
61 EXPECT_EQ(1u, 61 EXPECT_EQ(1u,
62 feature->extension_types()->count(Extension::TYPE_PLATFORM_APP)); 62 feature->extension_types()->count(Extension::TYPE_PLATFORM_APP));
63 63
64 DictionaryValue manifest; 64 DictionaryValue manifest;
65 manifest.SetString("name", "test extension"); 65 manifest.SetString("name", "test extension");
66 manifest.SetString("version", "1"); 66 manifest.SetString("version", "1");
67 ListValue* permissions = new ListValue(); 67 ListValue* permissions = new ListValue();
68 manifest.Set("permissions", permissions); 68 manifest.Set("permissions", permissions);
69 permissions->Append(Value::CreateStringValue("contextMenus")); 69 permissions->Append(Value::CreateStringValue("contextMenus"));
70 70
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 EXPECT_TRUE(provider->GetFeature("feature1")); 115 EXPECT_TRUE(provider->GetFeature("feature1"));
116 116
117 // feature2 won't validate because of the presence of "contexts". 117 // feature2 won't validate because of the presence of "contexts".
118 EXPECT_FALSE(provider->GetFeature("feature2")); 118 EXPECT_FALSE(provider->GetFeature("feature2"));
119 119
120 // If we remove it, it works. 120 // If we remove it, it works.
121 feature2->Remove("contexts", NULL); 121 feature2->Remove("contexts", NULL);
122 provider.reset(new SimpleFeatureProvider(value.get(), NULL)); 122 provider.reset(new SimpleFeatureProvider(value.get(), NULL));
123 EXPECT_TRUE(provider->GetFeature("feature2")); 123 EXPECT_TRUE(provider->GetFeature("feature2"));
124 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698