| 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();
|
|
|