Commit 1d1bf1cb authored by michaelpg's avatar michaelpg Committed by Commit bot

AppShell: Ignore channel requirements of extension API features

Make AppShell always the "unknown" channel, instead of always being "stable",
because (a) it doesn't have channels, (b) we want to test unstable APIs too, and
(c) saying app_shell is "dev channel" would be insulting to chrome dev channel.

This allows APIs like chrome.hid.getUserSelectedDevices to exist in app_shell. (That particular one crashes, but what can you do...)

BUG=none
R=steel@chromium.org

Review-Url: https://codereview.chromium.org/2580063003
Cr-Commit-Position: refs/heads/master@{#442748}
parent 75527aec
...@@ -46,7 +46,7 @@ Feature::Availability Feature::IsAvailableToEnvironment() const { ...@@ -46,7 +46,7 @@ Feature::Availability Feature::IsAvailableToEnvironment() const {
-1); // manifest_version -1); // manifest_version
} }
Feature::Feature() : no_parent_(false), check_channel_(false) {} Feature::Feature() : no_parent_(false) {}
Feature::~Feature() {} Feature::~Feature() {}
......
...@@ -150,15 +150,11 @@ class Feature { ...@@ -150,15 +150,11 @@ class Feature {
virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0; virtual bool IsIdInBlacklist(const std::string& extension_id) const = 0;
virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0; virtual bool IsIdInWhitelist(const std::string& extension_id) const = 0;
void set_check_channel(bool check_channel) { check_channel_ = check_channel; }
protected: protected:
std::string name_; std::string name_;
std::string alias_; std::string alias_;
std::string source_; std::string source_;
bool no_parent_; bool no_parent_;
// TODO(devlin): Remove this once we set the feature channel for tests.
bool check_channel_;
}; };
} // namespace extensions } // namespace extensions
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
#include "extensions/browser/null_app_sorting.h" #include "extensions/browser/null_app_sorting.h"
#include "extensions/browser/updater/null_extension_cache.h" #include "extensions/browser/updater/null_extension_cache.h"
#include "extensions/browser/url_request_util.h" #include "extensions/browser/url_request_util.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/shell/browser/api/generated_api_registration.h" #include "extensions/shell/browser/api/generated_api_registration.h"
#include "extensions/shell/browser/delegates/shell_kiosk_delegate.h" #include "extensions/shell/browser/delegates/shell_kiosk_delegate.h"
#include "extensions/shell/browser/shell_extension_host_delegate.h" #include "extensions/shell/browser/shell_extension_host_delegate.h"
...@@ -45,6 +47,9 @@ ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( ...@@ -45,6 +47,9 @@ ShellExtensionsBrowserClient::ShellExtensionsBrowserClient(
pref_service_(pref_service), pref_service_(pref_service),
api_client_(new ShellExtensionsAPIClient), api_client_(new ShellExtensionsAPIClient),
extension_cache_(new NullExtensionCache()) { extension_cache_(new NullExtensionCache()) {
// app_shell does not have a concept of channel yet, so leave UNKNOWN to
// enable all channel-dependent extension APIs.
SetCurrentChannel(version_info::Channel::UNKNOWN);
} }
ShellExtensionsBrowserClient::~ShellExtensionsBrowserClient() { ShellExtensionsBrowserClient::~ShellExtensionsBrowserClient() {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/version_info/version_info.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/shell/browser/desktop_controller.h" #include "extensions/shell/browser/desktop_controller.h"
...@@ -23,10 +22,7 @@ namespace extensions { ...@@ -23,10 +22,7 @@ namespace extensions {
AppShellTest::AppShellTest() AppShellTest::AppShellTest()
: browser_context_(nullptr), : browser_context_(nullptr),
extension_system_(nullptr), extension_system_(nullptr) {
// Default channel is STABLE but override with UNKNOWN so that unlaunched
// or incomplete APIs can write tests.
current_channel_(version_info::Channel::UNKNOWN) {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// TODO(phajdan.jr): Make browser tests self-contained on Mac; remove this. // TODO(phajdan.jr): Make browser tests self-contained on Mac; remove this.
// Set up the application path as though we we are inside the App Shell.app // Set up the application path as though we we are inside the App Shell.app
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_base.h" #include "content/public/test/browser_test_base.h"
#include "extensions/common/features/feature_channel.h"
namespace content { namespace content {
class BrowserContext; class BrowserContext;
...@@ -35,7 +34,6 @@ class AppShellTest : public content::BrowserTestBase { ...@@ -35,7 +34,6 @@ class AppShellTest : public content::BrowserTestBase {
protected: protected:
content::BrowserContext* browser_context_; content::BrowserContext* browser_context_;
ShellExtensionSystem* extension_system_; ShellExtensionSystem* extension_system_;
ScopedCurrentChannel current_channel_;
}; };
} // namespace extensions } // namespace extensions
......
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