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

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 2c08bcd129ec77a8c2f85abe6a7337d7eccc3695..9954fd1f04c48bf506d06a18afe0ef1306a2594a 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -29,6 +29,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"
@@ -400,7 +401,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"));
@@ -442,7 +445,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"));
@@ -480,7 +483,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializePartialAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -498,7 +501,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -518,7 +521,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -543,7 +546,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -565,7 +568,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -586,7 +589,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"));
@@ -632,7 +635,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
base::ScopedTempDir download_dir;
ASSERT_TRUE(download_dir.CreateUniqueTempDir());
@@ -699,7 +702,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- true);
+ net::HTTP_OK);
download_service_->CheckClientDownload(
&item,
@@ -762,7 +765,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"));
« no previous file with comments | « chrome/browser/safe_browsing/client_side_detection_service_unittest.cc ('k') | chrome/browser/signin/signin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698