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

Unified Diff: components/policy/core/common/cloud/device_management_service_unittest.cc

Issue 1928013004: Add delayed retry to DeviceManagementService requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit: punctuation Created 4 years, 7 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
« no previous file with comments | « components/policy/core/common/cloud/device_management_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/device_management_service_unittest.cc
diff --git a/components/policy/core/common/cloud/device_management_service_unittest.cc b/components/policy/core/common/cloud/device_management_service_unittest.cc
index fd4bf6535ca8ad2de4b201b5a0711bc1773348ea..3d3d0969aae45a51ea90c5f1a6b4f2f5dd64887b 100644
--- a/components/policy/core/common/cloud/device_management_service_unittest.cc
+++ b/components/policy/core/common/cloud/device_management_service_unittest.cc
@@ -51,6 +51,9 @@ const char kRobotAuthCode[] = "robot-oauth-auth-code";
class DeviceManagementServiceTestBase : public testing::Test {
protected:
DeviceManagementServiceTestBase() {
+ // Set retry delay to prevent timeouts.
+ policy::DeviceManagementService::SetRetryDelayForTesting(0);
+
request_context_ =
new net::TestURLRequestContextGetter(loop_.task_runner());
ResetService();
@@ -610,6 +613,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnProxyError) {
// Generate a callback with a proxy failure.
SendResponse(fetcher, net::ERR_PROXY_CONNECTION_FAILED, 200, std::string());
+ base::RunLoop().RunUntilIdle();
// Verify that a new URLFetcher was started that bypasses the proxy.
fetcher = GetFetcher();
@@ -640,6 +644,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnBadResponseFromProxy) {
// Generate a callback with a valid http response, that was generated by
// a bad/wrong proxy.
SendResponse(fetcher, net::OK, 200, std::string());
+ base::RunLoop().RunUntilIdle();
// Verify that a new URLFetcher was started that bypasses the proxy.
fetcher = GetFetcher();
@@ -666,6 +671,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnNetworkChanges) {
net::ERR_NETWORK_CHANGED));
fetcher->set_url(GURL(kServiceUrl));
fetcher->delegate()->OnURLFetchComplete(fetcher);
+ base::RunLoop().RunUntilIdle();
// Verify that a new URLFetcher was started that retries this job, after
// having called OnJobRetry.
@@ -692,6 +698,7 @@ TEST_F(DeviceManagementServiceTest, RetryLimit) {
net::ERR_NETWORK_CHANGED));
fetcher->set_url(GURL(kServiceUrl));
fetcher->delegate()->OnURLFetchComplete(fetcher);
+ base::RunLoop().RunUntilIdle();
Mock::VerifyAndClearExpectations(this);
}
@@ -705,6 +712,7 @@ TEST_F(DeviceManagementServiceTest, RetryLimit) {
net::ERR_NETWORK_CHANGED));
fetcher->set_url(GURL(kServiceUrl));
fetcher->delegate()->OnURLFetchComplete(fetcher);
+ base::RunLoop().RunUntilIdle();
Mock::VerifyAndClearExpectations(this);
}
« no previous file with comments | « components/policy/core/common/cloud/device_management_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698