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

Unified Diff: chrome/browser/policy/device_management_policy_provider_unittest.cc

Issue 4960003: Don't register gmail users at the device management server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 10 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/policy/device_management_policy_provider_unittest.cc
diff --git a/chrome/browser/policy/device_management_policy_provider_unittest.cc b/chrome/browser/policy/device_management_policy_provider_unittest.cc
index 57172869e4fe0dc8f7bffea3fe5b0bf05b1f9c05..a77c358956852abfa7cb47af1d97aac92c6fc3a6 100644
--- a/chrome/browser/policy/device_management_policy_provider_unittest.cc
+++ b/chrome/browser/policy/device_management_policy_provider_unittest.cc
@@ -14,6 +14,8 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/policy_constants.h"
#include "chrome/test/mock_notification_observer.h"
+#include "chrome/test/testing_device_token_fetcher.h"
+#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
const char kTestToken[] = "device_policy_provider_test_auth_token";
@@ -33,6 +35,7 @@ class DeviceManagementPolicyProviderTest : public testing::Test {
virtual void SetUp() {
EXPECT_TRUE(storage_dir_.CreateUniqueTempDir());
+ profile_.reset(new TestingProfile);
CreateNewBackend();
CreateNewProvider();
}
@@ -43,19 +46,24 @@ class DeviceManagementPolicyProviderTest : public testing::Test {
}
void CreateNewProvider() {
- token_service_.reset(new TokenService);
provider_.reset(new DeviceManagementPolicyProvider(
ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
backend_,
- token_service_.get(),
- storage_dir_.path()));
+ profile_.get(),
+ new TestingDeviceTokenFetcher(backend_,
+ profile_.get(),
+ storage_dir_.path())));
loop_.RunAllPending();
}
void SimulateSuccessfulLoginAndRunPending() {
loop_.RunAllPending();
- token_service_->IssueAuthTokenForTest(
+ profile_->GetTokenService()->IssueAuthTokenForTest(
GaiaConstants::kDeviceManagementService, kTestToken);
+ TestingDeviceTokenFetcher* fetcher =
+ static_cast<TestingDeviceTokenFetcher*>(
+ provider_->token_fetcher_.get());
+ fetcher->SimulateLogin(kTestDasherDomainUsername);
loop_.RunAllPending();
}
@@ -85,7 +93,7 @@ class DeviceManagementPolicyProviderTest : public testing::Test {
BrowserThread ui_thread_;
BrowserThread file_thread_;
ScopedTempDir storage_dir_;
- scoped_ptr<TokenService> token_service_;
+ scoped_ptr<Profile> profile_;
DISALLOW_COPY_AND_ASSIGN(DeviceManagementPolicyProviderTest);
};

Powered by Google App Engine
This is Rietveld 408576698