Commit ce79fa7a authored by kalman@chromium.org's avatar kalman@chromium.org

Force the channel to be dev for active tab and manfiest unit tests.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151435 0039d316-1c4b-4281-b951-d872f2087c98
parent 44479497
......@@ -55,11 +55,11 @@ scoped_refptr<const Extension> CreateTestExtension(
class ActiveTabTest : public TabContentsTestHarness {
public:
ActiveTabTest()
: extension(CreateTestExtension("deadbeef", true)),
: current_channel_(chrome::VersionInfo::CHANNEL_DEV),
extension(CreateTestExtension("deadbeef", true)),
another_extension(CreateTestExtension("feedbeef", true)),
extension_without_active_tab(CreateTestExtension("badbeef", false)),
ui_thread_(BrowserThread::UI, MessageLoop::current()),
current_channel_(chrome::VersionInfo::CHANNEL_DEV) {}
ui_thread_(BrowserThread::UI, MessageLoop::current()) {}
protected:
int tab_id() {
......@@ -106,6 +106,11 @@ class ActiveTabTest : public TabContentsTestHarness {
return extension->HasAPIPermissionForTab(tab_id, APIPermission::kTab);
}
// Force the test to run in dev channel because the permission is only
// available in dev channel. Without declaring this first, the extensions
// below won't load due to manifest errors.
Feature::ScopedCurrentChannel current_channel_;
// An extension with the activeTab permission.
scoped_refptr<const Extension> extension;
......@@ -117,7 +122,6 @@ class ActiveTabTest : public TabContentsTestHarness {
private:
content::TestBrowserThread ui_thread_;
Feature::ScopedCurrentChannel current_channel_;
};
TEST_F(ActiveTabTest, GrantToSinglePage) {
......
......@@ -16,7 +16,9 @@
using extensions::Extension;
ExtensionManifestTest::ExtensionManifestTest() : enable_apps_(true) {}
ExtensionManifestTest::ExtensionManifestTest()
: enable_apps_(true),
current_channel_(chrome::VersionInfo::CHANNEL_DEV) {}
// static
DictionaryValue* ExtensionManifestTest::LoadManifestFile(
......
......@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/features/feature.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace errors = extension_manifest_errors;
......@@ -135,6 +136,14 @@ class ExtensionManifestTest : public testing::Test {
EXPECT_TYPE type);
bool enable_apps_;
// Force the manifest tests to run as though it were dev channel, since
// several tests rely on manifest features being available that aren't
// on stable/beta.
//
// These objects nest, so if a test wants to explicitly test the behaviour
// on stable or beta, declare it inside that test.
extensions::Feature::ScopedCurrentChannel current_channel_;
};
#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_
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