Set the Feature's ChannelForTesting to Trunk during ActiveTabTest.

BUG=136629
TEST=no
TBR=aa@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10690144

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146213 0039d316-1c4b-4281-b951-d872f2087c98
parent 5d6688f0
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/browser/ui/tab_contents/test_tab_contents.h"
#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/features/feature.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_types.h"
...@@ -62,7 +63,9 @@ class ActiveTabTest : public TabContentsTestHarness { ...@@ -62,7 +63,9 @@ class ActiveTabTest : public TabContentsTestHarness {
another_extension(CreateTestExtension("another", true)), another_extension(CreateTestExtension("another", true)),
extension_without_active_tab( extension_without_active_tab(
CreateTestExtension("without activeTab", false)), CreateTestExtension("without activeTab", false)),
ui_thread_(BrowserThread::UI, MessageLoop::current()) {} ui_thread_(BrowserThread::UI, MessageLoop::current()) {
Feature::SetChannelForTesting(chrome::VersionInfo::CHANNEL_UNKNOWN);
}
protected: protected:
int tab_id() { int tab_id() {
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
#include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/extensions/features/feature.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -2368,7 +2369,7 @@ void ExtensionService::Observe(int type, ...@@ -2368,7 +2369,7 @@ void ExtensionService::Observe(int type,
// Extensions need to know the channel for API restrictions. // Extensions need to know the channel for API restrictions.
process->Send(new ExtensionMsg_SetChannel( process->Send(new ExtensionMsg_SetChannel(
chrome::VersionInfo::GetChannel())); extensions::Feature::GetCurrentChannel()));
// Valid extension function names, used to setup bindings in renderer. // Valid extension function names, used to setup bindings in renderer.
std::vector<std::string> function_names; std::vector<std::string> function_names;
......
...@@ -369,4 +369,11 @@ void Feature::ResetChannelForTesting() { ...@@ -369,4 +369,11 @@ void Feature::ResetChannelForTesting() {
g_channel.Get().ResetChannelForTesting(); g_channel.Get().ResetChannelForTesting();
} }
// static
chrome::VersionInfo::Channel Feature::GetCurrentChannel() {
if (g_channel_checking_enabled)
return g_channel.Get().GetChannel();
return chrome::VersionInfo::GetChannel();
}
} // namespace } // namespace
...@@ -81,6 +81,10 @@ class Feature { ...@@ -81,6 +81,10 @@ class Feature {
static void SetChannelForTesting(chrome::VersionInfo::Channel channel); static void SetChannelForTesting(chrome::VersionInfo::Channel channel);
static void ResetChannelForTesting(); static void ResetChannelForTesting();
// Returns the current channel as seen by the Feature system (i.e. the
// ChannelForTesting if one is set, otherwise the actual channel).
static chrome::VersionInfo::Channel GetCurrentChannel();
const std::string& name() const { return name_; } const std::string& name() const { return name_; }
void set_name(const std::string& name) { name_ = name; } void set_name(const std::string& name) { name_ = name; }
......
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