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

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

Issue 10664017: Introduce a new error code from the DM server - 402 - missing licenses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
Index: chrome/browser/policy/cloud_policy_controller_unittest.cc
diff --git a/chrome/browser/policy/cloud_policy_controller_unittest.cc b/chrome/browser/policy/cloud_policy_controller_unittest.cc
index b995c9a0f3c7e8781fe2a64859f321e424293d8f..dcea441a20feb38eba8cd1a9b8325fcdd0022ea6 100644
--- a/chrome/browser/policy/cloud_policy_controller_unittest.cc
+++ b/chrome/browser/policy/cloud_policy_controller_unittest.cc
@@ -40,6 +40,7 @@ class MockDeviceTokenFetcher : public DeviceTokenFetcher {
MOCK_METHOD0(FetchToken, void());
MOCK_METHOD0(SetUnmanagedState, void());
MOCK_METHOD0(SetSerialNumberInvalidState, void());
+ MOCK_METHOD0(SetMissingLicensesState, void());
private:
DISALLOW_COPY_AND_ASSIGN(MockDeviceTokenFetcher);
@@ -269,6 +270,20 @@ TEST_F(CloudPolicyControllerTest, InvalidSerialNumber) {
loop_.RunAllPending();
}
+// If the backend reports that the domain has run out of licenses, the
+// controller should instruct the token fetcher not to fetch a new token
+// (which will in turn set and persist the correct 'missing licenses' state).
+TEST_F(CloudPolicyControllerTest, MissingLicenses) {
+ data_store_->SetupForTesting("device_token", "device_id",
+ "who@what.com", "auth", true);
+ EXPECT_CALL(service_,
+ CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH))
+ .WillOnce(service_.FailJob(DM_STATUS_MISSING_LICENSES));
+ EXPECT_CALL(*token_fetcher_.get(), SetMissingLicensesState()).Times(1);
+ CreateNewController();
+ loop_.RunAllPending();
+}
+
TEST_F(CloudPolicyControllerTest, DontSetFetchingDoneWithoutTokens) {
CreateNewWaitingCache();
CreateNewController();

Powered by Google App Engine
This is Rietveld 408576698