summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 21:47:59 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 21:47:59 +0000
commit50f3c40fd0aba5ba66615966b9f323a123467ef8 (patch)
treeb93a2920e28b445bd81bea2d87c0036e54d91808
parent4cfb8c3f236e6cb3c9f6c2019ce40aa59241121a (diff)
downloadchromium_src-50f3c40fd0aba5ba66615966b9f323a123467ef8.zip
chromium_src-50f3c40fd0aba5ba66615966b9f323a123467ef8.tar.gz
chromium_src-50f3c40fd0aba5ba66615966b9f323a123467ef8.tar.bz2
Merge 146213 - Set the Feature's ChannelForTesting to Trunk during ActiveTabTest.
BUG=136629 TEST=no TBR=aa@chromium.org Review URL: https://chromiumcodereview.appspot.com/10690144 TBR=mpcomplete@chromium.org Review URL: https://chromiumcodereview.appspot.com/10703152 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@146215 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/active_tab_unittest.cc5
-rw-r--r--chrome/browser/extensions/extension_service.cc3
-rw-r--r--chrome/common/extensions/features/feature.cc7
-rw-r--r--chrome/common/extensions/features/feature.h4
4 files changed, 17 insertions, 2 deletions
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc
index 881829ce..c1c00e9 100644
--- a/chrome/browser/extensions/active_tab_unittest.cc
+++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/tab_contents/test_tab_contents.h"
#include "chrome/common/chrome_notification_types.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/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -62,7 +63,9 @@ class ActiveTabTest : public TabContentsTestHarness {
another_extension(CreateTestExtension("another", true)),
extension_without_active_tab(
CreateTestExtension("without activeTab", false)),
- ui_thread_(BrowserThread::UI, MessageLoop::current()) {}
+ ui_thread_(BrowserThread::UI, MessageLoop::current()) {
+ Feature::SetChannelForTesting(chrome::VersionInfo::CHANNEL_UNKNOWN);
+ }
protected:
int tab_id() {
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index f4063bc..5a51c04 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -93,6 +93,7 @@
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/extension_resource.h"
+#include "chrome/common/extensions/features/feature.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -2357,7 +2358,7 @@ void ExtensionService::Observe(int type,
// Extensions need to know the channel for API restrictions.
process->Send(new ExtensionMsg_SetChannel(
- chrome::VersionInfo::GetChannel()));
+ extensions::Feature::GetCurrentChannel()));
// Valid extension function names, used to setup bindings in renderer.
std::vector<std::string> function_names;
diff --git a/chrome/common/extensions/features/feature.cc b/chrome/common/extensions/features/feature.cc
index 550f9e3..7aed0a8 100644
--- a/chrome/common/extensions/features/feature.cc
+++ b/chrome/common/extensions/features/feature.cc
@@ -369,4 +369,11 @@ void Feature::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
diff --git a/chrome/common/extensions/features/feature.h b/chrome/common/extensions/features/feature.h
index 22ea034..7fcf80b 100644
--- a/chrome/common/extensions/features/feature.h
+++ b/chrome/common/extensions/features/feature.h
@@ -82,6 +82,10 @@ class Feature {
static void SetChannelForTesting(chrome::VersionInfo::Channel channel);
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_; }
void set_name(const std::string& name) { name_ = name; }