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

Unified Diff: chrome/browser/managed_mode/managed_user_service_unittest.cc

Issue 63423003: Set ENABLE_MANAGED_USERS #ifdef on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 7 years, 1 month 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
Index: chrome/browser/managed_mode/managed_user_service_unittest.cc
diff --git a/chrome/browser/managed_mode/managed_user_service_unittest.cc b/chrome/browser/managed_mode/managed_user_service_unittest.cc
index fa0f0627c1e1b39cadb9f093f43712f9f8d24206..d13b5b16c03365fb20f10a1e98b4ce20cedf2630 100644
--- a/chrome/browser/managed_mode/managed_user_service_unittest.cc
+++ b/chrome/browser/managed_mode/managed_user_service_unittest.cc
@@ -14,6 +14,8 @@
#include "chrome/browser/managed_mode/managed_user_service.h"
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
@@ -67,15 +69,26 @@ class ManagedModeURLFilterObserver : public ManagedModeURLFilter::Observer {
class ManagedUserServiceTest : public ::testing::Test {
public:
- ManagedUserServiceTest() {
- managed_user_service_ = ManagedUserServiceFactory::GetForProfile(&profile_);
+ ManagedUserServiceTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ TestingProfile::Builder builder;
+ builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
+ FakeProfileOAuth2TokenService::Build);
+ profile_ = builder.Build();
+ managed_user_service_ =
+ ManagedUserServiceFactory::GetForProfile(profile_.get());
+ }
+
+ virtual void TearDown() OVERRIDE {
+ profile_.reset();
}
virtual ~ManagedUserServiceTest() {}
protected:
content::TestBrowserThreadBundle thread_bundle_;
- TestingProfile profile_;
+ scoped_ptr<TestingProfile> profile_;
ManagedUserService* managed_user_service_;
};
@@ -88,7 +101,7 @@ TEST_F(ManagedUserServiceTest, GetManualExceptionsForHost) {
GURL kBlurpURL("http://blurp.net/bla");
GURL kMooseURL("http://moose.org/baz");
{
- DictionaryPrefUpdate update(profile_.GetPrefs(),
+ DictionaryPrefUpdate update(profile_->GetPrefs(),
prefs::kManagedModeManualURLs);
base::DictionaryValue* dict = update.Get();
dict->SetBooleanWithoutPathExpansion(kExampleFooURL.spec(), true);
@@ -116,7 +129,7 @@ TEST_F(ManagedUserServiceTest, GetManualExceptionsForHost) {
EXPECT_EQ(kExampleFooURL, exceptions[1]);
{
- DictionaryPrefUpdate update(profile_.GetPrefs(),
+ DictionaryPrefUpdate update(profile_->GetPrefs(),
prefs::kManagedModeManualURLs);
base::DictionaryValue* dict = update.Get();
for (std::vector<GURL>::iterator it = exceptions.begin();
@@ -142,15 +155,15 @@ TEST_F(ManagedUserServiceTest, GetManualExceptionsForHost) {
// DCHECK is hit when the service is destroyed, this test passed.
TEST_F(ManagedUserServiceTest, ShutDownCustodianProfileDownloader) {
CustodianProfileDownloaderService* downloader_service =
- CustodianProfileDownloaderServiceFactory::GetForProfile(
- &profile_);
+ CustodianProfileDownloaderServiceFactory::GetForProfile(profile_.get());
// Emulate being logged in, then start to download a profile so a
// ProfileDownloader gets created.
- profile_.GetPrefs()->SetString(prefs::kGoogleServicesUsername, "Logged In");
+ profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "Logged In");
downloader_service->DownloadProfile(base::Bind(&OnProfileDownloadedFail));
}
+#if !defined(OS_ANDROID)
class ManagedUserServiceExtensionTestBase : public ExtensionServiceTestBase {
public:
explicit ManagedUserServiceExtensionTestBase(bool is_managed)
@@ -383,3 +396,4 @@ TEST_F(ManagedUserServiceExtensionTest, InstallContentPacks) {
EXPECT_EQ(ManagedModeURLFilter::ALLOW,
url_filter->GetFilteringBehaviorForURL(moose_url));
}
+#endif // !defined(OS_ANDROID)
« no previous file with comments | « chrome/browser/managed_mode/managed_user_service.cc ('k') | chrome/browser/signin/fake_profile_oauth2_token_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698