Commit 9dfb3722 authored by scheib@chromium.org's avatar scheib@chromium.org

Remove service worker concepts from _api_features.json

BUG=396340

Review URL: https://codereview.chromium.org/414633002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285819 0039d316-1c4b-4281-b951-d872f2087c98
parent cab97b81
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace extensions { namespace extensions {
APIFeature::APIFeature() APIFeature::APIFeature()
: internal_(false), blocked_in_service_worker_(false) {} : internal_(false) {}
APIFeature::~APIFeature() { APIFeature::~APIFeature() {
} }
...@@ -16,17 +16,12 @@ bool APIFeature::IsInternal() const { ...@@ -16,17 +16,12 @@ bool APIFeature::IsInternal() const {
return internal_; return internal_;
} }
bool APIFeature::IsBlockedInServiceWorker() const {
return blocked_in_service_worker_;
}
std::string APIFeature::Parse(const base::DictionaryValue* value) { std::string APIFeature::Parse(const base::DictionaryValue* value) {
std::string error = SimpleFeature::Parse(value); std::string error = SimpleFeature::Parse(value);
if (!error.empty()) if (!error.empty())
return error; return error;
value->GetBoolean("internal", &internal_); value->GetBoolean("internal", &internal_);
value->GetBoolean("blocked_in_service_worker", &blocked_in_service_worker_);
if (contexts()->empty()) if (contexts()->empty())
return name() + ": API features must specify at least one context."; return name() + ": API features must specify at least one context.";
......
...@@ -18,13 +18,11 @@ class APIFeature : public SimpleFeature { ...@@ -18,13 +18,11 @@ class APIFeature : public SimpleFeature {
// extensions::Feature: // extensions::Feature:
virtual bool IsInternal() const OVERRIDE; virtual bool IsInternal() const OVERRIDE;
virtual bool IsBlockedInServiceWorker() const OVERRIDE;
virtual std::string Parse(const base::DictionaryValue* value) OVERRIDE; virtual std::string Parse(const base::DictionaryValue* value) OVERRIDE;
private: private:
bool internal_; bool internal_;
bool blocked_in_service_worker_;
}; };
} // namespace extensions } // namespace extensions
......
...@@ -12,20 +12,14 @@ ComplexFeature::ComplexFeature(scoped_ptr<FeatureList> features) { ...@@ -12,20 +12,14 @@ ComplexFeature::ComplexFeature(scoped_ptr<FeatureList> features) {
no_parent_ = features_[0]->no_parent(); no_parent_ = features_[0]->no_parent();
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
// Verify IsInternal and IsBlockedInServiceWorker are consistent across all // Verify IsInternal and no_parent is consistent across all features.
// features.
bool first_is_internal = features_[0]->IsInternal(); bool first_is_internal = features_[0]->IsInternal();
bool first_blocked_in_service_worker =
features_[0]->IsBlockedInServiceWorker();
for (FeatureList::const_iterator it = features_.begin() + 1; for (FeatureList::const_iterator it = features_.begin() + 1;
it != features_.end(); it != features_.end();
++it) { ++it) {
DCHECK(first_is_internal == (*it)->IsInternal()) DCHECK(first_is_internal == (*it)->IsInternal())
<< "Complex feature must have consistent values of " << "Complex feature must have consistent values of "
"internal across all sub features."; "internal across all sub features.";
DCHECK(first_blocked_in_service_worker == (*it)->IsBlockedInServiceWorker())
<< "Complex feature must have consistent values of "
"blocked_in_service_worker across all sub features.";
DCHECK(no_parent_ == (*it)->no_parent()) DCHECK(no_parent_ == (*it)->no_parent())
<< "Complex feature must have consistent values of " << "Complex feature must have consistent values of "
"no_parent across all sub features."; "no_parent across all sub features.";
...@@ -102,12 +96,6 @@ bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { ...@@ -102,12 +96,6 @@ bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const {
return false; return false;
} }
bool ComplexFeature::IsBlockedInServiceWorker() const {
// Constructor verifies that composed features are consistent, thus we can
// return just the first feature's value.
return features_[0]->IsBlockedInServiceWorker();
}
bool ComplexFeature::IsInternal() const { bool ComplexFeature::IsInternal() const {
// Constructor verifies that composed features are consistent, thus we can // Constructor verifies that composed features are consistent, thus we can
// return just the first feature's value. // return just the first feature's value.
......
...@@ -39,7 +39,6 @@ class ComplexFeature : public Feature { ...@@ -39,7 +39,6 @@ class ComplexFeature : public Feature {
virtual bool IsIdInBlacklist(const std::string& extension_id) const OVERRIDE; virtual bool IsIdInBlacklist(const std::string& extension_id) const OVERRIDE;
virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE; virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE;
virtual bool IsBlockedInServiceWorker() const OVERRIDE;
protected: protected:
// extensions::Feature: // extensions::Feature:
......
...@@ -6,14 +6,11 @@ ...@@ -6,14 +6,11 @@
#include "chrome/common/extensions/features/chrome_channel_feature_filter.h" #include "chrome/common/extensions/features/chrome_channel_feature_filter.h"
#include "chrome/common/extensions/features/feature_channel.h" #include "chrome/common/extensions/features/feature_channel.h"
#include "extensions/common/features/api_feature.h"
#include "extensions/common/features/simple_feature.h" #include "extensions/common/features/simple_feature.h"
#include "extensions/common/test_util.h"
#include "extensions/common/value_builder.h" #include "extensions/common/value_builder.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using chrome::VersionInfo; using chrome::VersionInfo;
using extensions::APIFeature;
using extensions::ComplexFeature; using extensions::ComplexFeature;
using extensions::DictionaryBuilder; using extensions::DictionaryBuilder;
using extensions::Feature; using extensions::Feature;
...@@ -21,7 +18,6 @@ using extensions::ListBuilder; ...@@ -21,7 +18,6 @@ using extensions::ListBuilder;
using extensions::Manifest; using extensions::Manifest;
using extensions::ScopedCurrentChannel; using extensions::ScopedCurrentChannel;
using extensions::SimpleFeature; using extensions::SimpleFeature;
using extensions::test_util::ParseJsonDictionaryWithSingleQuotes;
namespace { namespace {
...@@ -165,56 +161,6 @@ TEST_F(ExtensionComplexFeatureTest, MultipleRulesChannels) { ...@@ -165,56 +161,6 @@ TEST_F(ExtensionComplexFeatureTest, MultipleRulesChannels) {
} }
} }
// Tests a complex feature with blocked_in_service_worker returns true for
// IsBlockedInServiceWorker().
TEST_F(ExtensionComplexFeatureTest, BlockedInServiceWorker) {
scoped_ptr<ComplexFeature::FeatureList> features(
new ComplexFeature::FeatureList());
// Two feature rules, both with blocked_in_service_worker: true.
scoped_ptr<SimpleFeature> api_feature(new APIFeature());
api_feature->Parse(ParseJsonDictionaryWithSingleQuotes(
"{"
" 'channel': 'trunk',"
" 'blocked_in_service_worker': true"
"}").get());
features->push_back(api_feature.release());
api_feature.reset(new APIFeature());
api_feature->Parse(ParseJsonDictionaryWithSingleQuotes(
"{"
" 'channel': 'stable',"
" 'blocked_in_service_worker': true"
"}").get());
features->push_back(api_feature.release());
EXPECT_TRUE(ComplexFeature(features.Pass()).IsBlockedInServiceWorker());
}
// Tests a complex feature without blocked_in_service_worker returns false for
// IsBlockedInServiceWorker().
TEST_F(ExtensionComplexFeatureTest, NotBlockedInServiceWorker) {
scoped_ptr<ComplexFeature::FeatureList> features(
new ComplexFeature::FeatureList());
// Two feature rules without blocked_in_service_worker.
scoped_ptr<SimpleFeature> api_feature(new APIFeature());
api_feature->Parse(ParseJsonDictionaryWithSingleQuotes(
"{"
" 'channel': 'trunk'"
"}").get());
features->push_back(api_feature.release());
api_feature.reset(new APIFeature());
api_feature->Parse(ParseJsonDictionaryWithSingleQuotes(
"{"
" 'channel': 'stable'"
"}").get());
features->push_back(api_feature.release());
EXPECT_FALSE(ComplexFeature(features.Pass()).IsBlockedInServiceWorker());
}
// Tests that dependencies are correctly checked. // Tests that dependencies are correctly checked.
TEST_F(ExtensionComplexFeatureTest, Dependencies) { TEST_F(ExtensionComplexFeatureTest, Dependencies) {
scoped_ptr<ComplexFeature::FeatureList> features( scoped_ptr<ComplexFeature::FeatureList> features(
......
...@@ -114,9 +114,6 @@ class Feature { ...@@ -114,9 +114,6 @@ class Feature {
// Tests whether this is an internal API or not. // Tests whether this is an internal API or not.
virtual bool IsInternal() const = 0; virtual bool IsInternal() const = 0;
// Returns True for features excluded from service worker backed contexts.
virtual bool IsBlockedInServiceWorker() const = 0;
// Returns true if the feature is available to be parsed into a new extension // Returns true if the feature is available to be parsed into a new extension
// manifest. // manifest.
Availability IsAvailableToManifest(const std::string& extension_id, Availability IsAvailableToManifest(const std::string& extension_id,
......
...@@ -513,8 +513,6 @@ bool SimpleFeature::IsInternal() const { ...@@ -513,8 +513,6 @@ bool SimpleFeature::IsInternal() const {
return false; return false;
} }
bool SimpleFeature::IsBlockedInServiceWorker() const { return false; }
bool SimpleFeature::IsIdInBlacklist(const std::string& extension_id) const { bool SimpleFeature::IsIdInBlacklist(const std::string& extension_id) const {
return IsIdInList(extension_id, blacklist_); return IsIdInList(extension_id, blacklist_);
} }
......
...@@ -106,7 +106,6 @@ class SimpleFeature : public Feature { ...@@ -106,7 +106,6 @@ class SimpleFeature : public Feature {
Context context) const OVERRIDE; Context context) const OVERRIDE;
virtual bool IsInternal() const OVERRIDE; virtual bool IsInternal() const OVERRIDE;
virtual bool IsBlockedInServiceWorker() const OVERRIDE;
virtual bool IsIdInBlacklist(const std::string& extension_id) const OVERRIDE; virtual bool IsIdInBlacklist(const std::string& extension_id) const OVERRIDE;
virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE; virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment