| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 return; | 317 return; |
| 318 | 318 |
| 319 // Process robot refresh token fetch if the auth code fetch succeeded. | 319 // Process robot refresh token fetch if the auth code fetch succeeded. |
| 320 // DeviceCloudPolicyManagerChromeOS holds an EnrollmentHandlerChromeOS which | 320 // DeviceCloudPolicyManagerChromeOS holds an EnrollmentHandlerChromeOS which |
| 321 // holds a GaiaOAuthClient that fetches the refresh token during enrollment. | 321 // holds a GaiaOAuthClient that fetches the refresh token during enrollment. |
| 322 // We return a successful OAuth response via a TestURLFetcher to trigger the | 322 // We return a successful OAuth response via a TestURLFetcher to trigger the |
| 323 // happy path for these classes so that enrollment can continue. | 323 // happy path for these classes so that enrollment can continue. |
| 324 if (robot_auth_fetch_status_ == DM_STATUS_SUCCESS) { | 324 if (robot_auth_fetch_status_ == DM_STATUS_SUCCESS) { |
| 325 net::TestURLFetcher* url_fetcher = url_fetcher_factory_.GetFetcherByID(0); | 325 net::TestURLFetcher* url_fetcher = url_fetcher_factory_.GetFetcherByID(0); |
| 326 ASSERT_TRUE(url_fetcher); | 326 ASSERT_TRUE(url_fetcher); |
| 327 // The logic in GaiaOAuthClient seems broken, it always retries 1x on | 327 url_fetcher->SetMaxRetriesOn5xx(0); |
| 328 // non-200 response codes, even if the retries are set to 0. Seems like | |
| 329 // its num_retries_ > source->GetMaxRetriesOn5xx() should have a >=? | |
| 330 url_fetcher->SetMaxRetriesOn5xx(-2); | |
| 331 url_fetcher->set_status(net::URLRequestStatus()); | 328 url_fetcher->set_status(net::URLRequestStatus()); |
| 332 url_fetcher->set_response_code(url_fetcher_response_code_); | 329 url_fetcher->set_response_code(url_fetcher_response_code_); |
| 333 url_fetcher->SetResponseString(url_fetcher_response_string_); | 330 url_fetcher->SetResponseString(url_fetcher_response_string_); |
| 334 url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); | 331 url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); |
| 335 } | 332 } |
| 336 base::RunLoop().RunUntilIdle(); | 333 base::RunLoop().RunUntilIdle(); |
| 337 | 334 |
| 338 // Process policy store. | 335 // Process policy store. |
| 339 device_settings_test_helper_.set_store_result(store_result_); | 336 device_settings_test_helper_.set_store_result(store_result_); |
| 340 device_settings_test_helper_.FlushStore(); | 337 device_settings_test_helper_.FlushStore(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { | 475 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { |
| 479 loaded_blob_.clear(); | 476 loaded_blob_.clear(); |
| 480 RunTest(); | 477 RunTest(); |
| 481 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); | 478 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); |
| 482 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, | 479 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, |
| 483 status_.store_status()); | 480 status_.store_status()); |
| 484 } | 481 } |
| 485 | 482 |
| 486 } // namespace test | 483 } // namespace test |
| 487 } // namespace policy | 484 } // namespace policy |
| OLD | NEW |