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

Unified Diff: chrome/browser/safe_browsing/download_protection_service_unittest.cc

Issue 48713008: [sync] Allow FakeURLFetcher to return arbitrary HTTP response codes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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/safe_browsing/download_protection_service_unittest.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
index c77767ddee9bd18b952ff6df6d0c33435c5df111..bdc43bf5ab2233418c26a0cedbc1fa8dcc6c8759 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -31,6 +31,7 @@
#include "content/public/test/mock_download_item.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "net/cert/x509_certificate.h"
+#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -404,7 +405,9 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) {
net::FakeURLFetcherFactory factory(NULL);
// HTTP request will fail.
factory.SetFakeResponse(
- DownloadProtectionService::GetDownloadRequestUrl(), std::string(), false);
+ DownloadProtectionService::GetDownloadRequestUrl(),
+ std::string(),
+ net::HTTP_INTERNAL_SERVER_ERROR);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
@@ -446,7 +449,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
@@ -484,7 +487,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializePartialAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -502,7 +505,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -522,7 +525,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -547,7 +550,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -569,7 +572,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -590,7 +593,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadHTTPS) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
@@ -636,7 +639,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
base::ScopedTempDir download_dir;
ASSERT_TRUE(download_dir.CreateUniqueTempDir());
@@ -703,7 +706,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -766,7 +769,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientCrxDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_crx(FILE_PATH_LITERAL("a.crx"));

Powered by Google App Engine
This is Rietveld 408576698