Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6076)

Unified Diff: chrome/browser/extensions/extensions_service_unittest.cc

Issue 132045: Re-enable the --enable-extensions flag. Fix a bunch of bugs (Closed)
Patch Set: unblech Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/browser/profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extensions_service_unittest.cc
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index e41a84a10f7f87e6708b1667e96ef16b10cb27bd..06d343cdd4bf5e163b6647958cea257c1789db14 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -5,6 +5,7 @@
#include <algorithm>
#include <vector>
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/json_reader.h"
@@ -24,6 +25,7 @@
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -130,7 +132,8 @@ class ExtensionsServiceTest
NotificationService::AllSources());
profile_.reset(new TestingProfile());
- service_ = new ExtensionsService(profile_.get(), &loop_, &loop_);
+ service_ = new ExtensionsService(
+ profile_.get(), CommandLine::ForCurrentProcess(), &loop_, &loop_);
service_->SetExtensionsEnabled(true);
service_->set_show_extensions_prompts(false);
@@ -1023,3 +1026,30 @@ TEST_F(ExtensionsServiceTest, ExternalInstallPref) {
ASSERT_EQ(0u, loaded_.size());
ASSERT_EQ(1u, GetErrors().size());
}
+
+// Test that we get enabled/disabled correctly for all the pref/command-line
+// combinations.
+TEST(ExtensionsServiceTest2, Enabledness) {
+ TestingProfile profile;
+ MessageLoop loop;
+ scoped_ptr<CommandLine> command_line;
+ scoped_refptr<ExtensionsService> service;
+
+ // By default, we are disabled.
+ command_line.reset(new CommandLine(L""));
+ service = new ExtensionsService(&profile, command_line.get(), &loop, &loop);
+ EXPECT_FALSE(service->extensions_enabled());
+
+ // If either the command line or pref is set, we are enabled.
+ command_line->AppendSwitch(switches::kEnableExtensions);
+ service = new ExtensionsService(&profile, command_line.get(), &loop, &loop);
+ EXPECT_TRUE(service->extensions_enabled());
+
+ profile.GetPrefs()->SetBoolean(prefs::kEnableExtensions, true);
+ service = new ExtensionsService(&profile, command_line.get(), &loop, &loop);
+ EXPECT_TRUE(service->extensions_enabled());
+
+ command_line.reset(new CommandLine(L""));
+ service = new ExtensionsService(&profile, command_line.get(), &loop, &loop);
+ EXPECT_TRUE(service->extensions_enabled());
+}
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/browser/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698