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

Unified Diff: chrome/browser/captive_portal/captive_portal_detector_unittest.cc

Issue 11419070: Added detection timeouts and usage of Retry-After HTTP header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 8 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/captive_portal/captive_portal_detector_unittest.cc
diff --git a/chrome/browser/captive_portal/captive_portal_detector_unittest.cc b/chrome/browser/captive_portal/captive_portal_detector_unittest.cc
index def2e57431880fb10e3bf46caecde2c2c44b508d..d9d926d0d3f2e4063b9972fe2e242ac09ef3b6de 100644
--- a/chrome/browser/captive_portal/captive_portal_detector_unittest.cc
+++ b/chrome/browser/captive_portal/captive_portal_detector_unittest.cc
@@ -12,8 +12,6 @@
#include "chrome/test/base/testing_profile.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
-#include "net/http/http_response_headers.h"
-#include "net/url_request/test_url_fetcher_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace captive_portal {
@@ -68,7 +66,6 @@ class CaptivePortalDetectorTest : public testing::Test,
GURL url(CaptivePortalDetector::kDefaultURL);
CaptivePortalClient client(detector());
- net::TestURLFetcherFactory factory;
detector()->DetectCaptivePortal(url,
base::Bind(&CaptivePortalClient::OnPortalDetectionCompleted,
base::Unretained(&client)));
@@ -76,22 +73,7 @@ class CaptivePortalDetectorTest : public testing::Test,
ASSERT_TRUE(FetchingURL());
MessageLoop::current()->RunUntilIdle();
- net::TestURLFetcher* fetcher = factory.GetFetcherByID(0);
- if (net_error != net::OK) {
- EXPECT_FALSE(response_headers);
- fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::FAILED,
- net_error));
- } else {
- fetcher->set_response_code(status_code);
- if (response_headers) {
- scoped_refptr<net::HttpResponseHeaders> headers(
- CreateResponseHeaders(response_headers));
- EXPECT_EQ(status_code, headers->response_code());
- fetcher->set_response_headers(headers);
- }
- }
-
- OnURLFetchComplete(fetcher);
+ CompleteURLFetch(net_error, status_code, response_headers);
EXPECT_FALSE(FetchingURL());
EXPECT_EQ(1, client.num_results_received());
@@ -106,7 +88,6 @@ class CaptivePortalDetectorTest : public testing::Test,
GURL url(CaptivePortalDetector::kDefaultURL);
CaptivePortalClient client(detector());
- net::TestURLFetcherFactory factory;
detector()->DetectCaptivePortal(url,
base::Bind(&CaptivePortalClient::OnPortalDetectionCompleted,
base::Unretained(&client)));
« no previous file with comments | « chrome/browser/captive_portal/captive_portal_detector.cc ('k') | chrome/browser/captive_portal/captive_portal_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698